Results 1 to 3 of 3

Thread: [RESOLVED] Help with simple code

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    5

    Resolved [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.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Help with simple code

    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim sText As String
    3.     'Save the text in a string variable
    4.     sText = Text1.Text
    5.     'check the first two characters
    6.     If Left$(sText, 2) = "AB" Then
    7.         'do something
    8.     End If
    9.     'check the next 3 characters
    10.     If Mid$(sText, 3, 3) = "CDE" Then
    11.         'do something
    12.     End If
    13.     'check the last character
    14.     If Right$(sText, 1) = "F" Then
    15.         'do something
    16.     End If
    17. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    5

    Re: Help with simple code

    awesome, thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width