-
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
-
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.
-
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
-
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
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 01-25-2000).]