Results 1 to 12 of 12

Thread: [RESOLVED] New to VB 6! Can't code this program.. :(

Threaded View

  1. #10

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    32

    Re: New to VB 6! Can't code this program.. :(

    Quote Originally Posted by MarkT
    See if this gets you going in the right direction
    VB Code:
    1. Option Explicit
    2. Dim strGuests(4) As String
    3.  
    4. Private Sub Command1_Click()
    5. Dim blnValid As Boolean
    6. Dim strInput As String
    7. Dim i As Integer
    8.  
    9.     Do
    10.         'Get the name
    11.         strInput = LCase(InputBox("Who are you?"))
    12.         'Check if the name is in the array
    13.         For i = 0 To 4
    14.             If LCase(strGuests(i)) = strInput Then
    15.                 blnValid = True
    16.                 Exit For
    17.             End If
    18.         Next i
    19.     'Loop while a valid name has not been entered
    20.     Loop While Not blnValid
    21.    
    22.     MsgBox "valid name"
    23. End Sub
    24.  
    25. Private Sub Form_Load()
    26.     strGuests(0) = "Vert"
    27.     strGuests(1) = "dclamp"
    28.     strGuests(2) = "vntalk"
    29.     strGuests(3) = "si_the_geek"
    30.     strGuests(4) = "MarkT"
    31. End Sub
    That helps a lot! Thanks!

    I think this will be enough to start me off.
    Last edited by vert; Jan 22nd, 2007 at 03:13 PM.

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