Re: DoEvents not working

From: Armin Zingler (az.nospam_at_freenet.de)
Date: 05/03/04


Date: Mon, 3 May 2004 18:20:05 +0200


"P. Prosper" <mocanoREMOVETHIS@moca-coop.com> schrieb
> Hello both,
> Sorry I was away for the weekend
> to clarify the situation ...
> I agree that iterating through 10000 records would not give me the
> time to click the button. But as posted in my initial Post, the loop
> take over 10 minutes to complete (thanks to the lines wher
> crptStatement (crystal report statement) appear)
>
> yes the button is enabled . I did try setting a break in the button
> click event but it does'nt even get there.
> I tried :
> If i = 100 Then
>
> CmdCancel.PerformClick()
>
> 'End If
>
> inside the loop and the logic does work. It's seems as if the crystal
> report is blocking the thread to the point where the click event
> does'nt get executed.

DoEvents should be sufficient to be able to click the button.

I'm still interested in: Does the button change the visual state when
holding down the mouse?

Maybe the form looses focus when CR starts printing.

Replace a single call of application.doevents by this (only for testing):

    dim start as integer
    start = environment.tickcount

    do
        application.doevents
    loop until environment.tickcount - start > 2000 orelse CancelPrint

    if cancelprint then stop

Try again and see if the button can be clicked and the stop statement is
reached.
Don't forget to remove your CmdCancel.PerformClick. ;-)

-- 
Armin
How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html