This blog is a depository for things I have found regarding VB.NET and C#.NET development (and other things I may need to remember). This blog is primarily for my own reference, but if the information I found is useful to others, then that is great. If others want to contribute with comments or other information, then that is great too.
I believe that the problem here is that the Console app is not a Form and DoEvents is part of Sytem.Windows.Forms. The console app isn't event driven, so that is probably why this method is not supported there. However, if you are wanting to have other events processed in other applications that are running, then you may be able to say something like:
System.Threading.Thread.Sleep(10)
and it might accomplish what you are trying to do since while the console app is sleeping, the other apps should get their slice of the processing time more easily.
4 comments:
Just FYI in Visual Basic 2008 express edition in a console application this:
System.Windows.Forms.Application.DoEvents()
gives the error - 'Windows' is not a member of 'System'
I believe that the problem here is that the Console app is not a Form and DoEvents is part of Sytem.Windows.Forms. The console app isn't event driven, so that is probably why this method is not supported there. However, if you are wanting to have other events processed in other applications that are running, then you may be able to say something like:
System.Threading.Thread.Sleep(10)
and it might accomplish what you are trying to do since while the console app is sleeping, the other apps should get their slice of the processing time more easily.
You should be able to add a reference to System.Windows.Forms even in a Console app, and then call System.Windows.Forms.Application.DoEvents()
It Worked fine for me, just make sure you add a reference to System.Windows.Forms in your project properties and at the beggining of the code add:
Imports System.Windows.Forms
This was posted before just wanted to elaborate a little more.
Thanks for the info, I had spent hours looking for this.
Med Toledo
Post a Comment