martes, 26 de diciembre de 2017

Validar números TextBox

If String.IsNullOrEmpty(tbnumber.Text.Trim("0")) Then
            tbnumber.Clear()
            MessageBox.Show("Ingrese un valor mayor que cero")

            Exit Sub
        Else
            Dim number As Long = 0
            Dim result As Boolean = Int64.TryParse(tbnumber.Text.Trim, number)

            If Not result Then
                MessageBox.Show("Número no válido")
            Else
                tbnumber.Text = tbnumber.Text.TrimStart("0")
            End If

            MessageBox.Show(result)
        End If

No hay comentarios.:

Publicar un comentario