-
Dec 3rd, 2005, 08:51 PM
#1
Thread Starter
Lively Member
DoEvent
any one now how can i free DoEvent Stack (clear empty ..stop )
i tray lackwindowsUpdate and me.visible=false its working but not 4 me
thanks
-
Dec 3rd, 2005, 09:02 PM
#2
Re: DoEvent
I'm sorry but I don't understand. Do you mean DoEvents? And what is the DoEvent stack?
-
Dec 3rd, 2005, 10:04 PM
#3
Thread Starter
Lively Member
Re: DoEvents
yes DoEvents
let say im runing a loop for 1 day lol
now i click on a button on the Form whan the loop is finsh
it's run
it going to do the event mouse down ? that i did before
or any events that i did ? how can i stop it from doing Events ?
my project dont have any DoEvents()
thanks
Last edited by imosha; Dec 3rd, 2005 at 10:17 PM.
-
Dec 3rd, 2005, 10:13 PM
#4
Hyperactive Member
-
Dec 3rd, 2005, 10:31 PM
#5
Thread Starter
Lively Member
Re: DoEvent
Example
Private WorkInProgress as boolean
Private sub Command1_Click()
WorkInProgress =true
dim X as long
for x=1 to 10000
debug.print time
next
WorkInProgress =false
''''((( free eventes )))
end sub
Private sub Command2_Click()
if WorkInProgress =true the exit sub ' not working
debug.print "Click Whan the loop is runing"
'''''((( i dont like that command 2 will work )))
end sub
Last edited by imosha; Dec 3rd, 2005 at 10:43 PM.
-
Dec 3rd, 2005, 10:38 PM
#6
Hyperactive Member
Re: DoEvent
I think I understand what you're looking for. You don't want the user to be able to click any buttons while your program is in the middle of doing work.
There is no quick option that I'm aware of.
But it's not very difficult to handle it in code.
Before you start your loop, set a variable like WorkInProgress=True
Then in your click event just do
If WorkInProgress Then Exit Sub
-
Dec 3rd, 2005, 10:41 PM
#7
Re: DoEvent
You can set the enabled property of the buttons to False while your code is running.
-
Dec 3rd, 2005, 10:45 PM
#8
Thread Starter
Lively Member
Re: DoEvent
WorkInProgress not working
and Enabeld not working
the only way that it will work is if i put DoEvents in the loop
Last edited by imosha; Dec 3rd, 2005 at 10:48 PM.
-
Dec 3rd, 2005, 10:51 PM
#9
Re: DoEvent
You don't need it to fire every iteration on the loop, unless each iteration takes very long. You could have it fire every 10 to 1000 iterations.
VB Code:
for x=1 to 10000
if x mod 1000 = 0 then doevents
endif
-
Dec 3rd, 2005, 10:54 PM
#10
Thread Starter
Lively Member
Re: DoEvent
Originally Posted by dglienna
You don't need it to fire every iteration on the loop, unless each iteration takes very long. You could have it fire every 10 to 1000 iterations.
VB Code:
for x=1 to 10000
if x mod 1000 = 0 then doevents
endif
yes i now it will work but not on my program
i dont have a small loop but if i must i do that
i like 2 free the events all events
-
Dec 3rd, 2005, 11:27 PM
#11
Re: DoEvent
I don't understand what you are trying to do. You are running a loop, and you don't want users to click on a button? If you set command1.enabled=false, they won't be able to press the button. If you use DoEvents, it WILL allow them to press the button while your loop is executing.
Please explain exactly what you want to happen.
-
Dec 3rd, 2005, 10:51 PM
#12
Thread Starter
Lively Member
Re: DoEvent
The Events are stack in windows i like 2 delete them after the loop is
finsh how can i find them i dont know and how 2 delete them
and only them?
-
Dec 4th, 2005, 01:13 AM
#13
Re: DoEvent
use lockwindow update to lock your window so it cant be touched.
-
Dec 4th, 2005, 04:34 AM
#14
Re: DoEvent
VB Code:
Private Sub Command1_Click()
MsgBox "This app will now run in the background"
Form1.Visible = False
Do Until x > 1000
Loop
Form1.Visible = True
End Sub
-
Dec 4th, 2005, 10:49 AM
#15
Re: DoEvent
Originally Posted by Jmacp
VB Code:
Private Sub Command1_Click()
MsgBox "This app will now run in the background"
Form1.Visible = False
Do Until x > 1000
Loop
Form1.Visible = True
End Sub
The Form1.Enabled should do better. This way the user will be able to see the form but can't do anything on it.
Pradeep
-
Dec 4th, 2005, 10:56 AM
#16
Hyperactive Member
Re: DoEvent
Originally Posted by Pradeep1210
The Form1.Enabled should do better. This way the user will be able to see the form but can't do anything on it.
Pradeep
Good answer. Yes, set form1.enabled = false and then form1.enabled = true when you are done with your loop.
-
Dec 4th, 2005, 07:31 PM
#17
Thread Starter
Lively Member
Re: DoEvent
it's not the best
what u need 2 do if this what u like is 2 put a contener Like a picbox and set him 2 false and not the form.
but what i was asking is that i like 2 free the event stack in windows
that it will do the last event only
but i think i must stay whit that
thank you all 4 helping me
you are the best
this is the code
pic.enabeld= false
for I= 1 to 10000
if I mod 200 = 0 then doevents (or down)
debug.print Time
next I
(or up) doevents
pic.enabeld=true
end sub
sorry abut my english i cant read or right well
http://msdn.microsoft.com/library/de...dowshookex.asp
this is a defrant way 2 do that didnt test it yet
Last edited by imosha; Dec 4th, 2005 at 07:42 PM.
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
|