cdiego

VALIDAR_CAMPOS_ENTEROS_Y_DECIMAL_VISUAL_BASIC

Feb 10th, 2014
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class funciones
  2.     Public Shared Function ValidarCampoEntero(CajaDeTexto As TextBox) As Boolean
  3.         Try
  4.             Dim d As Integer = Convert.ToInt32(CajaDeTexto.Text)
  5.             Return True
  6.         Catch ex As Exception
  7.             CajaDeTexto.Text = "0"
  8.             CajaDeTexto.Select(0, CajaDeTexto.Text.Length)
  9.             Return False
  10.         End Try
  11.     End Function
  12.  
  13.     Public Shared Function ValidarCampoDecimal(CajaDeTexto As TextBox) As Boolean
  14.         Try
  15.             Dim d As Decimal = Convert.ToDecimal(CajaDeTexto.Text)
  16.             Return True
  17.         Catch ex As Exception
  18.             CajaDeTexto.Text = "0"
  19.             CajaDeTexto.Select(0, CajaDeTexto.Text.Length)
  20.             Return False
  21.         End Try
  22.     End Function
  23. End Class
Advertisement
Add Comment
Please, Sign In to add comment