Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Command1_Click()
- Call Comprobar_Caracter(Text1.Text)
- End Sub
- Private Sub Form_Load()
- Text1.MaxLength = 1
- End Sub
- Private Sub Comprobar_Caracter(Cadena As String)
- If Len(Cadena) > 1 Then MsgBox "Solo se puede analizar un caracter", vbCritical, "Error": Exit Sub
- Dim Vocal As String, Consonante As String, Numero As String
- Vocal = "aeiou"
- Consonante = "bcdfghjklmnñpqrstvwxyz"
- Numero = "1234567890"
- If Not InStr(1, Vocal, Cadena) = 0 Then
- MsgBox "El caracter """ & Cadena & """ es una vocal", vbInformation
- ElseIf Not InStr(1, Consonante, Cadena) = 0 Then
- MsgBox "El caracter """ & Cadena & """ es una consonante", vbInformation
- ElseIf Not InStr(1, Numero, Cadena) = 0 Then
- MsgBox "El caracter """ & Cadena & """ es un número", vbInformation
- Else
- MsgBox "El caracter """ & Cadena & """ es un símbolo", vbInformation
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment