Questions tagged [doevents]
106 questions
3
votes
5 answers
Waiting for a long process and still updating UI
I've been attempting to create a task that writes to a database without blocking the UI thread. The biggest problem I'm having is waiting for that process to finish without the blocking happening.
I've been trying to avoid using DoEvents (though…

Trevor Watson
- 415
- 1
- 8
- 20
3
votes
2 answers
.net hang on Application.DoEvents
One of our legacy products is a Winforms application and instead of using background threads it does everything on the main UI thread. It has a constant loop running on this main thread that calls Application.DoEvents() every 20 ms. Once in a while…

John K
- 830
- 1
- 7
- 18
3
votes
11 answers
How do I delay a vb.net program until a file operation completes?
I have this:
Dim myTemp As String
myTemp = System.DateTime.Now().ToString("MMMddyyyy_HHmmss") & ".pdf"
System.IO.File.Copy(myFile, "c:\" & myTemp)
Application.DoEvents()
OpenFile(myTemp)
The problem is that when I call…

johnny
- 19,272
- 52
- 157
- 259
3
votes
3 answers
When do I know to call DoEvents?
If I'm looping through a prolonged operation (say, processing files) and I want to update a progress bar, I need to use DoEvents, from what I can understand.
But calling it during every loop of the function only results in the progress bar's…

qJake
- 16,821
- 17
- 83
- 135
3
votes
2 answers
Is Application.DoEvents() my only choice (in this case)?
I have some commercial equipment that I can connect to with a .Net library supplied by the equipment manufacturer - so I have no control over the library or the equipment, only my code.
The manufacturer has set their system up so that if you are not…

Peter M
- 7,309
- 3
- 50
- 91
3
votes
1 answer
Custom Modal Window in WPF?
I have a WPF application where I'd like to create a custom pop-up that has modal behavior. I've been able to hack up a solution using an equivalent to 'DoEvents', but is there a better way to do this? Here is what I have currently:
private…

Dan Bryant
- 27,329
- 4
- 56
- 102
3
votes
1 answer
vb6 kill/skip CreateObject call
Can someone suggest how I can terminate or go around a CreateObject operation that occasionally takes minutes to finish? Basically I have this code:
Set m_Zeacom = CreateObject("QmCOM.QIntegrate")
that works instantly most of the time, but for some…

user3042375
- 33
- 4
3
votes
2 answers
Is there in dart language any method similar to DoEvents() in Visual Basic?
Here is a simple question.
suppose that I have a very long loop to execute, It would be nice to keep the user informed about the progressing right? I would print for example the number of loops that have been executed so far and how many are…

Munatas Meddur
- 41
- 2
3
votes
3 answers
Why does putting DoEvents in a loop cause a StackOverflow exception?
I was getting a weird error in a legacy application (not written by myself), where I was getting a StackOverflow exception when I changed the date on a calendar.
A simplified version is below. This is the code-behind of a Windows Form containing two…

JMK
- 27,273
- 52
- 163
- 280
3
votes
1 answer
.Net 4.5 and Task.Yield vs Task.Delay as an alternative to DoEvents? Which to use?
I have been reading up on the async/await syntax introduced in .Net 4.5 and getting a feel of it.
I have found simple samples where Task.Yield is the way to go rather than Application.DoEvents. I tried one of the samples (filling in the blanks)
Code…

Wolf5
- 16,600
- 12
- 59
- 58
2
votes
1 answer
Refresh a control
I am trying to change a link label's fore color but the color won't graphically change.
I have a timer that updates the fore color of the control
private void Timer_Tick(object sender, EventArgs e)
{
MyLbl.ForeColor = shouldUpdate?…

user779444
- 1,365
- 4
- 21
- 38
2
votes
0 answers
C# COM Interop and Application.DoEvents()
I found the following code and am trying to implement it in a COM module:
public Bitmap GetThumbnail()
{
ThreadStart _threadstart = new ThreadStart(GenerateThumbnail);
Thread _thread = new…

winepress
- 21
- 1
2
votes
2 answers
Problem with Application.DoEvents() while waiting for WebBrowser to finish loading
I'm trying to load WebBrowser content and after that I want to add some text and scroll to the bottom.
Here's example of my code:
webBrowser1.Url = new System.Uri("file:///" + filePath);
webBrowser1.Document.Body.InnerHtml +=…

alcohol is evil
- 686
- 12
- 34
2
votes
4 answers
Can you catch exception from inside Application.DoEvents()?
I've encountered a strange difference between a program running in VS2005 and running the executable directly. Essentially, when an exception is thrown in a method inside an Application.DoEvents() call, the exception can be caught when running…

recursive
- 83,943
- 34
- 151
- 241
2
votes
1 answer
Create a wait delay alternative to Application.DoEvents
For years I create delays in my software using, for example:
Wait(10000)
Sub Wait(milliseconds)
Do
…
user2510696