|
-
Nov 15th, 2005, 02:45 AM
#1
Thread Starter
New Member
[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
Last edited by Hack; Nov 15th, 2005 at 07:14 AM.
-
Nov 15th, 2005, 02:53 AM
#2
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
-
Nov 15th, 2005, 02:54 AM
#3
Thread Starter
New Member
Re: Help with simple code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|