Private Sub txtn_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
txtn.KeyPress '---------------------------------valida solo letras If Char.IsLetter(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False ElseIf Char.IsSeparator(e.KeyChar) Then e.Handled = False Else e.Handled = True End If
'--------------------------------------------------------------nros 'If InStr("0123456789", e.KeyChar) = False Then
' If (Asc(e.KeyChar)) <> 8 And (Asc(e.KeyChar)) <> 46 And
(Asc(e.KeyChar)) <> 45 Then
' e.Handled = True
' End If
'End If
End Sub
Private Sub txtd_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
txtd.KeyPress If Char.IsLetter(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False ElseIf Char.IsSeparator(e.KeyChar) Then e.Handled = False Else e.Handled = True End If End Sub
Private Sub btnregistrar_Click(sender As Object, e As EventArgs) Handles
btnregistrar.Click Dim obj As New dcneptunoDataContext
If txtn.TextLength > 0 And txtd.TextLength > 0 Then
obj.pa_regcateg(txtn.Text, txtd.Text) Else MessageBox.Show("ingrese valor en cajas de texto") txtn.Focus() End If End Sub End Class