Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Dim FirstVal As Boolean = False
- Dim SecondVal As Boolean = False
- Dim ThirdVal As Boolean = False
- Dim LengthVal As Boolean = False
- Dim UserID As String
- Console.WriteLine("Enter User ID")
- UserID = Console.ReadLine()
- If Len(UserID) = 6 Then
- LengthVal = True
- Else
- Console.WriteLine("Wrong format, due to length not being 6")
- End If
- If Asc(Left(UserID, 1)) >= 65 And Asc(Left(UserID, 1)) <= 90 Then
- FirstVal = True
- Else
- Console.WriteLine("Wrong format, due to first letter not being uppercase")
- End If
- If Asc(Mid(UserID, 2, 2)) >= 97 And Asc(Mid(UserID, 2, 2)) <= 122 Then
- SecondVal = True
- Else
- Console.WriteLine("Wrong format, due to second and third letters not being lowercase")
- End If
- For count = 1 To 3
- If Asc(Right(UserID, count)) >= 48 And Asc(Right(UserID, count)) <= 57 Then
- ThirdVal = True
- Else
- Console.WriteLine("Wrong format, due to last 3 characters not being numbers")
- End If
- Next
- If FirstVal = True And SecondVal = True And ThirdVal = True And LengthVal = True Then
- Console.WriteLine("Therefore, User ID is in the correct format")
- Else
- Console.WriteLine("Therefore, User ID is in the wrong format")
- End If
- Console.ReadKey()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement