473,419 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

DoEvents not working

Hello,
Could someone give me a hint why my CancelPrint Logic won't work despite the
DoEvents ?

in form lvele declaration I have
Public Shared CancelPrint As Boolean

'Printing Logic
Do While rsAccount.EOF = False And CancelPrint = False
Application.DoEvents()
SelFormula = "{Socios.NumSocio} in " & Chr(34) &
rsAccount.Fields("NumSocio").Value & Chr(34) & " to " & Chr(34) &
rsAccount.Fields("NumSocio").Value & Chr(34)
Dim crptStatement As New crptStatements_ATH
If ChkNotificacion.CheckState = CheckState.Unchecked Then
crptStatement.Section7.SectionFormat.EnableSuppres s = True
Else
crptStatement.Section7.SectionFormat.EnableSuppres s = False
End If
crptStatement.RecordSelectionFormula = SelFormula
i = i + 1
ProgressBar1.Value = i
crptStatement.PrintToPrinter(1, False, 0, 0)
rsAccount.MoveNext()
Loop

If CancelPrint Then
MsgBox("Printing Canceled By User", MsgBoxStyle.Exclamation)
End If

Private Sub CmdCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
'This togles the CancelPrint flag
CmdCancel.Click
CancelPrint = True
End Sub
Nov 20 '05
50 2420
"P. Prosper" <mo**************@moca-coop.com> schrieb
I haven't notice the "printing page ..." message. Also, I tried
your suggestion on setting a trap in the LostFocus event of CmdCancel
but the button did not lose focus (I did CmdCancel.Focus before
entering the loop).

Hmm, yes, that's what I've also noticed: :)
Anyway, while testing, my Button does not loose the focus and I can
click it. So my speculation was wrong... Sorry, I wished I found
the solution.

--
Armin

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

Nov 20 '05 #51

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jon Lewis | last post by:
I'm trying to make a 'Working' dialog with a rotating hourglass which displays during a long process. The dialog says hit <Esc> to cancel the process. If <Esc> is hit, the 'Process' ends and...
6
by: Ollie Riches | last post by:
I understand the use of Application.DoEvents() to process all outstanding messages on the message queue in a winforms application if you have long running process on the UI thread. But can anyone...
17
by: Lance | last post by:
I've noticed that calling DoEvents is much slower in an application that has called Application.EnableVisualStyles in Sub Main. Furthermore, the performance seems to worsen each time that DoEvents...
12
by: Jack Russell | last post by:
My unstanding of all VB up to and including vb6 is that an event could not "interrupt" itself. For instance if you had a timer event containing a msgbox then you would only get one message. ...
0
by: Mika M | last post by:
Hi! I'm using Rs232-class, which was shipped with 101 VB.NET samples by Microsoft. Application is made to read COM-port with the following code... Try Me.tmrReadCommPort.Enabled = True If...
8
by: TrtnJohn | last post by:
I have an application where I would like to block waiting on an asynchronous event and still process messages. I can implement a hard loop to block such as: Do While StillWaiting...
3
by: Dennis | last post by:
I find myself having to use Application.DoEvents to clear out my program events before proceeding to the next line of code, especially when working with MCI and using "NOTIFY" callback. Is this...
5
by: james.jdunne | last post by:
System.ArgumentException: Item has already been added. Key in dictionary: "-1" Key being added: "-1" at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at...
12
by: Justin | last post by:
I can attach my code if anyone wants to see it however I'll try to ask my question with some mark up code first. I'm having a problem terminating my process while using DoEvents. For example: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.