Questions tagged [doevents]

102 questions
280
votes
10 answers

Use of Application.DoEvents()

Can Application.DoEvents() be used in C#? Is this function a way to allow the GUI to catch up with the rest of the app, in much the same way that VB6's DoEvents does?
Craig Johnston
  • 7,037
  • 15
  • 37
  • 47
25
votes
3 answers

How to use DoEvents() without being "evil"?

A simple search for DoEvents brings up lots of results that lead, basically, to: DoEvents is evil. Don't use it. Use threading instead. The reasons generally cited are: Re-entrancy issues Poor performance Usability issues (e.g. drag/drop over a…
user541686
  • 189,354
  • 112
  • 476
  • 821
22
votes
2 answers

What is equivalent to Application.DoEvents() in WPF applications

From MSDN, it seems that Application.DoEvents() is available in Windows.Forms. What would be the equivalent thing in WPF.
Shamim Hafiz
  • 19,616
  • 36
  • 104
  • 164
22
votes
4 answers

What does "DoEvents" do in vb6?

What does "DoEvents" do in vb6 ? Why do I get the error message "Out of stack space" ? What does it mean ?
faressoft
  • 17,177
  • 42
  • 96
  • 138
12
votes
3 answers

Application.DoEvents, when it's necessary and when it's not?

What is the necessity of using Application.DoEvents and when we should use it?
odiseh
  • 22,127
  • 30
  • 101
  • 150
8
votes
3 answers

How to wait for a Power Query refresh to finish?

Setup: Windows 7 (at work) Windows 10 (at home) Excel 2016 (build 4627 at work) Excel 2016 (build 8730 at home) Power Query is setup to import, append, and transform a folder of Excel Files. This step works. After using any technique to wait for a…
neurojelly
  • 83
  • 1
  • 1
  • 5
7
votes
4 answers

Is Application.DoEvents() just for WinForms?

Is Application.DoEvents() just for forms? I thought that this command was used to ensure that all of the commands before are processed but now after reading the documentation, I'm not sure anymore.
Jaime Oro
  • 8,369
  • 8
  • 29
  • 38
6
votes
2 answers

How to pump message for COM STA threads in C#?

I have a main STA thread that calls a lot methods on the COM object and a secondary STA thread that does a lot work on the same object too. I want the main thread and the secondary thread to work in parallel (i.e. I expect interlaced output from the…
Charlie
  • 704
  • 1
  • 13
  • 23
5
votes
2 answers

Alternative to Application.DoEvents()

I am developing a messaging system based on webBrowser controls so that I can format the text however I please. When the user is offline and is sent messages, the messages are stored and an event is sent for every message when they log back in. …
Nathan Tornquist
  • 5,698
  • 8
  • 42
  • 69
5
votes
1 answer

Why can't I use Call infront of DoEvents?

In VBA, you can call your methods/functions with Call ahead of them, to tell the compiler explicitly that you don't want to use the return value if there is any. Now the DoEvents function should also be possible to be called via Call, but I can't…
Mafii
  • 6,538
  • 1
  • 33
  • 52
5
votes
3 answers

Application.DoEvents vs await Task.Delay in a loop

Much to my discontent, I need to use a WebBrowser control in one of my apps. One of the things I also need to do is wait for an element to become visible/class changes/etc, which happens well after the DocumentCompleted event is fired, making the…
JohnUbuntu
  • 567
  • 4
  • 17
5
votes
2 answers

DoEvents, Waiting, and Editing

I have a set of code that contains: Application.Wait (Now + TimeValue("4:00:00")) This is essentially pausing the macro for a four hour window from 3 AM (when it finishs running the code) till 7 AM (when it should resume). The code is on an…
user2263642
  • 91
  • 1
  • 3
  • 8
4
votes
2 answers

Does DoEvents effect only the current thread?

I have a simple 'Working' form that runs on its own thread to keep the user informed that the application hasn't died during long running operations. In order to get the working form to update I had to insert a DoEvents() call. I'm curious, will…
Kratz
  • 4,180
  • 3
  • 30
  • 51
4
votes
1 answer

Flashing animation getting interrupted by DoEvents

I have written some simple code in Excel VBA, to make a range "flash" a colour - this is achieved by carefully drawing a rectangle object over the range in question, and varying its transparency to make the box fade gradually. Here's the code (in…
Greedo
  • 3,465
  • 2
  • 19
  • 49
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
  • 265
  • 1
  • 5
  • 18
1
2 3 4 5 6 7