PDA

Click to See Complete Forum and Search --> : How do I loop somthing in the for_load event ?


lumin
Jan 24th, 2000, 04:24 AM
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 ?


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

raicheman
Jan 24th, 2000, 06:20 AM
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.

lumin
Jan 24th, 2000, 06:27 AM
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

Serge
Jan 24th, 2000, 09:30 PM
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:


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.


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 (http://www.icq.com/51055819)


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