|
-
Mar 21st, 2000, 08:55 AM
#1
Thread Starter
Addicted Member
Hi
when I create a timer can i just paste some code into it and it will constantly refresh itself I.E evry 50 millisecond ?
Example:
Code:
Private Sub tmrCheck_Timer()
NumberOfUsers = frmUsers.txtOperator.Count - 1
For i = 0 To NumberOfUsers
If Text2.Text = frmUsers.txtOperator(i).Text & " : " Then
If Text2.Text = frmUsers.txtOperator(i).Text & " : " & "?help" Or frmUsers.txtOperator(i).Text & " : " & Text2.Text = "?Help" Then
Text1.Text = "This is the help menu"
Send_Click
Else
End If
End If
Next i
End Sub
(I know the code abowe is somewhat unclean but thats not important right now)
because I need the code to constantly search the text box for that string and using a loop function did just hang the computer 
im not used to use timers (hardly use them at all)
some help would be appreciated
Thanks.
-Lumin
-
Mar 21st, 2000, 09:05 AM
#2
Hyperactive Member
Why dont you just chuck the code in there, run it and see for yourself????
-
Mar 21st, 2000, 09:09 AM
#3
Thread Starter
Addicted Member
Because I tried the example abowe and it didn't work, so I thought I might hadleft somthing out.
anyway if i set the count to 0 in the timer controll will it update at all then ?
-Lumin
-
Mar 21st, 2000, 09:26 AM
#4
Hyperactive Member
Ok, here are a few tips.
1. If you set the timer to 0 it wont work at all
2. When you first get into the timer function set it to 0
3. Do your stuff in the middle
4. Set the Interval to what you want before you leave.
The reason for doing this is so that it wont even attempt to go off while you are actually running the code inside it. If the interval you set is too short then it cannot go off again while it is currently being run so it doesn't go off again.
Setting it to 0 to begin with says "While I am doing this, I dont want it to work again"
Setting it to the interval you require when you finish (ie the very last line) says "I want it to go off again in X milliseconds from NOW"
Try that
-
Mar 21st, 2000, 10:12 AM
#5
Frenzied Member
TO CONSTANTLY CHECK THE TEXT BOX YOU SHOULD USE THE TEXT_CHANGE EVENT FORM THE TEXTBOX
ANY QUESTION
[email protected]
-
Mar 21st, 2000, 11:49 AM
#6
Thread Starter
Addicted Member
I have already tried the text change event, and it didn't work for some reason. 
Right now it feels like this project never is going to work.
BTW. thanks for the help Gen-X
-Lumin
-
Mar 21st, 2000, 12:02 PM
#7
Hyperactive Member
Something just occured to me... and it may solve your problem.
After the line Text1.Text = ....
Add the following
What this does is forces the control to refresh its contents and in some cases forms dont get a chance to refresh with other events being triggered.
-
Mar 21st, 2000, 12:52 PM
#8
Hyperactive Member
Another thing you want to be sure is that the Timer1.Enabled = True.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|