|
-
March 8th, 2012, 02:29 AM
#1
[Help] How to associate a timer to my function.. ?
I am facing another issue. I want to associate a timer to my function. Actually what i am doing is that i am tryin to store certain values in a database. A function is such that it calculates 5 values and stores them in a database. While storing them in the database it displays them in a textbox on the form. Now i want to display them one by one which it does. But it does it so fast that i can only see the last value that it enters in the database inside the textbox.
Can i make it show all the values slowly one by one.
Can anybody suggest me how to do so. I googled a lot but could find a particular answer.
thnx in advance friends..
-
March 8th, 2012, 06:53 AM
#2
Re: [Help] How to associate a timer to my function.. ?
A good solution greatly depends on your existing code.
1. The easiest thing is to delay your loop by using the Sleep API to wait for a couple of milliseconds/seconds. But this has several disadvantages.
2. You could use a timer control to create a wait-loop
Code:
'this is your loop
...
txtDisplay.Text = NextValue
Timer1.Enabled = True
While Timer1.Enabled: DoEvents: Wend
...
' this is the code in the timer event:
Private Sub Timer1_Timer()
Timer1.enabled = False
End Sub
Depending on your coding, where these values you compute are stored and how long they are stored and in what scope they are stored, you could use the timer control in a different way, to display all values one by the other, while the program is continuing already.
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
|