CLR: .Net / Mono / Boo / Otros CLR > VB .NET
Enteros Con Punto Flotante
(1/1)
lexidre:
hola, nesecito ayuda con un trabajo que estoy haciendo. Este consiste en ingresar en un cuadro de texto solo valores numericos pero que permita ingresar el valor con UNA coma si este es un float
cualkier ayuda sirve :comp: :comp:
Cajami:
hola que tal bueno mira esto es lo que se me ocurrió si puedes mejorarlo bacan B)
--- Código: Text --- Public Class Form1 Dim I As Byte Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Asc(e.KeyChar) = 44 Then If I = 1 Then e.Handled = True Exit Sub End If I = 1 Exit Sub End If If Asc(e.KeyChar) = 8 Then Exit Sub End If If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then e.Handled = True End If End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If Me.TextBox1.Text.IndexOf(",") = -1 Then I = 0 End If End SubEnd Class
bueno espero que te sirva, nos vemos :hola:
lexidre:
:lol: vele compa yo estube weando con el KeyChar caleta de rato pero no me salio, gracias este programa maldito me tiene chato vale :D
Navegación
Ir a la versión completa