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
Printable View
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
I'm sorry but I don't understand. Do you mean DoEvents? And what is the DoEvent stack?
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
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
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
You can set the enabled property of the buttons to False while your code is running.
WorkInProgress not working
and Enabeld not working
:(
the only way that it will work is if i put DoEvents in the loop
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
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?
yes i now it will work but not on my programQuote:
Originally Posted by dglienna
i dont have a small loop but if i must i do that
i like 2 free the events all events
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.
use lockwindow update to lock your window so it cant be touched.
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.Quote:
Originally Posted by Jmacp
Pradeep :)
Good answer. Yes, set form1.enabled = false and then form1.enabled = true when you are done with your loop.Quote:
Originally Posted by Pradeep1210
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 :wave:
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