Decimales en la TextBox
Publicado por Sebastian Alonso (4 intervenciones) el 04/01/2024 20:12:00
Aqui esta un codigo para aceptar unicamente numeros y un punto decimal en tu textbox
1
2
3
4
5
6
7
8
9
10
11
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
If (Not Char.IsDigit(e.KeyChar) AndAlso e.KeyChar <> "."c AndAlso e.KeyChar <> ControlChars.Back) Then
e.Handled = True
End If
If e.KeyChar = "."c AndAlso TextBox1.Text.Contains(".") Then
e.Handled = True
End If
If e.KeyChar = "0"c AndAlso TextBox1.Text = "0" Then
e.Handled = True
End If
End Sub
Valora esta pregunta


0