[RESOLVED] Help with simple code
I am writing a really simple program where you type in a 6 character string into a textbox and press a command button.. i need to know how to make the button read the first 2 characters, then the next 3, then the last 1.. and with an if-then function, give a true or false value.. i hope this makes sense.. if you could post an example of how to do this it would be appreciated
Added [RESOLVED] to thread title and green "resolved" checkmark - Hack
Re: Help with simple code
VB Code:
Private Sub Command1_Click()
Dim sText As String
'Save the text in a string variable
sText = Text1.Text
'check the first two characters
If Left$(sText, 2) = "AB" Then
'do something
End If
'check the next 3 characters
If Mid$(sText, 3, 3) = "CDE" Then
'do something
End If
'check the last character
If Right$(sText, 1) = "F" Then
'do something
End If
End Sub
Re: Help with simple code