Mrm2299

Vocal /cononante/ numero

Jan 21st, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.91 KB | None | 0 0
  1. Private Sub Command1_Click()
  2.    Call Comprobar_Caracter(Text1.Text)
  3. End Sub
  4.  
  5. Private Sub Form_Load()
  6.    Text1.MaxLength = 1
  7. End Sub
  8.  
  9. Private Sub Comprobar_Caracter(Cadena As String)
  10.    If Len(Cadena) > 1 Then MsgBox "Solo se puede analizar un caracter", vbCritical, "Error": Exit Sub
  11.    Dim Vocal As String, Consonante As String, Numero As String
  12.    Vocal = "aeiou"
  13.    Consonante = "bcdfghjklmnñpqrstvwxyz"
  14.    Numero = "1234567890"
  15.    If Not InStr(1, Vocal, Cadena) = 0 Then
  16.        MsgBox "El caracter """ & Cadena & """ es una vocal", vbInformation
  17.    ElseIf Not InStr(1, Consonante, Cadena) = 0 Then
  18.        MsgBox "El caracter """ & Cadena & """ es una consonante", vbInformation
  19.    ElseIf Not InStr(1, Numero, Cadena) = 0 Then
  20.        MsgBox "El caracter """ & Cadena & """ es un número", vbInformation
  21.    Else
  22.        MsgBox "El caracter """ & Cadena & """ es un símbolo", vbInformation
  23.    End If
  24. End Sub
Advertisement
Add Comment
Please, Sign In to add comment