doevents

How to wait for a Power Query refresh to finish? I've tried “DoEvents” with “BackgroundQuery = False”, and more, nothing works

懵懂的女人 提交于 2020-08-04 04:39:47
问题 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. Description of Problem After using any combination of any technique to wait for a Power Query to finish refreshing as described in the "Things I have tried:" section shown below. A message box can be displayed and any other code can be executed before the Power Query tables have finished

How to wait for a Power Query refresh to finish? I've tried “DoEvents” with “BackgroundQuery = False”, and more, nothing works

时光总嘲笑我的痴心妄想 提交于 2020-08-04 04:39:38
问题 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. Description of Problem After using any combination of any technique to wait for a Power Query to finish refreshing as described in the "Things I have tried:" section shown below. A message box can be displayed and any other code can be executed before the Power Query tables have finished

How to pass booleon back from Worker_ProgressChanged to Worker_DoWork

岁酱吖の 提交于 2020-07-08 02:35:51
问题 I'm using a Background worker to read values in and to pass values to Worker_ProgressChanged, to update UI. In Worker_DoWork: while (agi.DvmReadyToRead) // wait for digipot to be adjusted before reading in worker { Thread.Sleep(20); Application.DoEvents(); //logS.Debug("Waiting for ready to read in worker"); } Thread.Sleep(40); // Give digipot chance to make the change agi.SendSoftwareTriggerOne(); Thread.Sleep(7); // Duration for above command to execute A = agi.ReadOne(); Thread.Sleep(1);

DoEvents, Waiting, and Editing

折月煮酒 提交于 2020-01-01 10:58:31
问题 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 endless loop essentially. I want the user to be able to have control during that time to edit certain cells. I have tried DoEvents but have not found the way to keep the macro running, yet provide control to the user during that time when the macro is

What's the proper way to wait for a .NET thread to start up?

霸气de小男生 提交于 2019-12-24 01:44:11
问题 I was reading the following on Microsoft's website within their threading tutorial: http://msdn.microsoft.com/en-us/library/aa645740(v=vs.71).aspx MSDN suggests using the following to wait for a thread to become alive: while (!oThread.IsAlive); Is this the recommended way to wait? Would it be better to insert a "DoEvents" call to allow the main thread to remain responsive? How should error handling be done in case something goes wrong and the thread never comes "alive?" If this is bad

Problem with Application.DoEvents() while waiting for WebBrowser to finish loading

柔情痞子 提交于 2019-12-24 01:24:33
问题 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 += text; webBrowser1.Document.Body.ScrollTop = webBrowser1.Document.Body.ScrollRectangle.Height; When I run it, there's an unhandled exception "Object reference not set to an instance of an object". Or when I comment line that does the scrolling, then text is added to

How do I delay a vb.net program until a file operation completes?

筅森魡賤 提交于 2019-12-23 15:44:41
问题 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 OpenFile, which is just a call to a sub that opens a file, it cannot find the file. This is because it is calling it so quickly that the program doesn't have time to actually create the file before the open takes place. I thought that DoEvents() would rectify this but it does

Application.DoEvents vs await Task.Delay in a loop

為{幸葍}努か 提交于 2019-12-22 10:56:40
问题 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 event close to useless in my case. So currently I have something like... while (webBrowser.Document?.GetElementById("id")?.GetAttribute("classname") != "class") { Application.DoEvents(); Thread.Sleep(1); } Now I've read in multiple places that

Get ReadyState from WebBrowser control without DoEvents

随声附和 提交于 2019-12-17 07:41:07
问题 This has been awnsered many times here and at other sites and its working, but I would like ideas to other ways to: get the ReadyState = Complete after using a navigate or post, without using DoEvents because of all of its cons. I would also note that using the DocumentComplete event woud not help here as I wont be navigating on only one page, but one after another like this. wb.navigate("www.microsoft.com") //dont use DoEvents loop here wb.Document.Body.SetAttribute(textbox1, "login") //dont

Waiting for a long process and still updating UI

℡╲_俬逩灬. 提交于 2019-12-12 15:04:49
问题 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 it's used quite frequently through this program right now, I'd like to move out of using it while moving forward). I've attempted to create the process to run on a 2nd thread and waiting for it to finish as well as using a BackgroundWorker . The