Results 1 to 4 of 4

Thread: How do I loop somthing in the for_load event ?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Bergen, Norway
    Posts
    143

    Post

    Hi.

    How do I loop somthing in the form_load event ?
    has totaly forgot how the loop thingies work.

    is there any possebilitys that i can loop this ?

    Code:
    NumberOfUsers = frmUsers.txtOperator.Count - 1
    For i = 0 To NumberOfUsers
    
    If Text2.Text = frmUsers.txtOperator(i).Text & " : " Then
    
    If Text2.Text = "?help" Or Text2.Text = "?Help" Then
    Text1.Text = "This is the help menu"
    Send_Click
    
    If Text2.Text = "?ban" Or Text2.Text = "?Ban" Then
    Text1.Text = "/ban"
    Send_Click
    
    Else
    
    End If
    End If
    End If
    
    Next i
    Thanks in Advance.


    -Lumin

  2. #2
    Junior Member
    Join Date
    Jun 1999
    Location
    St. Louis MO USA
    Posts
    18

    Post


    If frmUsers is the form you are using for the Form_load event, txtOperator.count has not value in it until the form is loaded. So until the for is loaded you could not run any of this code. The same is true for the text1 and text2 in you code.
    You could use a get Command line in the form initialize event.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Bergen, Norway
    Posts
    143

    Post

    thats not the problem. the problem is taht i need to know how the loop commands work.

    anyway thanks.

    BTW. the form is already loaded and its hidden.


    -Lumin

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    There are basically 2 types of loops: Do...Loop and For...Next

    The difference is:

    Do...Loop - is going to repeat (loop) while the expression is true:

    Code:
    Dim i As Integer
    
    Do While i < 10 
        i = i + 1
    Loop
    This loop will repeat until i will be more or equal to 10, i.e. if the expression of i < 10 is true.

    For...Next is a numeric representation of Loop. It will repeat as many times as you tell it to.

    Code:
    Dim i As Integer
    
    For i = 1 To 10
       'Here will be some code
    Next
    You can actually think of it as a Do...Loop as it will repeat until i will be more then 10, or expression of i > 10 will be true.

    Read more about this in MSDN library.

    ------------------

    Serge

    Programmer Analyst
    sdymkov@microage.com
    Access8484@aol.com
    ICQ#: 51055819


    [This message has been edited by Serge (edited 01-25-2000).]

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