473,396 Members | 1,738 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,396 software developers and data experts.

DoEvents in C#?

Just starting C# from a VB background.

Is there a C# keyword comparable to the vb keyword DoEvents?

Tony!

Nov 16 '05 #1
8 21833
See Application.DoEvents method

HTH
Alex

"Tony" <no**@none.com> wrote in message
news:8g********************************@4ax.com...
Just starting C# from a VB background.

Is there a C# keyword comparable to the vb keyword DoEvents?

Tony!

Nov 16 '05 #2
push ctrl-alt-j and search for doevents, you will find it is Application.DoEvents()

--
Michael Culley
"Tony" <no**@none.com> wrote in message news:8g********************************@4ax.com...
Just starting C# from a VB background.

Is there a C# keyword comparable to the vb keyword DoEvents?

Tony!

Nov 16 '05 #3
Tony <no**@none.com> wrote:
Just starting C# from a VB background.

Is there a C# keyword comparable to the vb keyword DoEvents?


Others have posted about Application.DoEvents() - but most of the time
when you need to call DoEvents, you should actually be thinking of
using a different thread instead.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
I don't know if that's really true. If you want your app to be doing only one thing but allow the user to cancel it or just to allow
the GUI to update then doevents is quite suitable.

--
Michael Culley
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:MP************************@msnews.microsoft.c om...
Tony <no**@none.com> wrote:
Just starting C# from a VB background.

Is there a C# keyword comparable to the vb keyword DoEvents?


Others have posted about Application.DoEvents() - but most of the time
when you need to call DoEvents, you should actually be thinking of
using a different thread instead.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #5
It's now part of the .net framework:

Application.DoEvents();
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #6
Michael Culley <mc*****@NOSPAMoptushome.com.au> wrote:
I don't know if that's really true. If you want your app to be doing
only one thing but allow the user to cancel it or just to allow the
GUI to update then doevents is quite suitable.


I'm afraid I disagree - you need to work out where to call DoEvents,
make sure you don't have reentrancy problems etc. I believe it's far
cleaner to start a new thread - it will also make your UI itself
perform better for repaint requests etc, as it won't have to wait for
your next call to DoEvents before repainting.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #7
Hi Michael,

I totally agree with Jon.
DoEvents was good because there was no multithreading with VB<=6.
You really should use Backgroundthread thread instead.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Michael Culley" <mc*****@NOSPAMoptushome.com.au> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...
I don't know if that's really true. If you want your app to be doing only one thing but allow the user to cancel it or just to allow the GUI to update then doevents is quite suitable.

--
Michael Culley
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message

news:MP************************@msnews.microsoft.c om...
Tony <no**@none.com> wrote:
Just starting C# from a VB background.

Is there a C# keyword comparable to the vb keyword DoEvents?


Others have posted about Application.DoEvents() - but most of the time
when you need to call DoEvents, you should actually be thinking of
using a different thread instead.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #8
Michael,

I'm going to throw my hat in with Jon and Miha as well. DoEvents is not
the way to go. As a matter of fact, I find DoEvents to be downright evil,
and even encouraged MS to take DoEvents off the Application class.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Michael Culley" <mc*****@NOSPAMoptushome.com.au> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...
I don't know if that's really true. If you want your app to be doing only one thing but allow the user to cancel it or just to allow the GUI to update then doevents is quite suitable.

--
Michael Culley
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message

news:MP************************@msnews.microsoft.c om...
Tony <no**@none.com> wrote:
Just starting C# from a VB background.

Is there a C# keyword comparable to the vb keyword DoEvents?


Others have posted about Application.DoEvents() - but most of the time
when you need to call DoEvents, you should actually be thinking of
using a different thread instead.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #9

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

Similar topics

24
by: bazad | last post by:
Hi, I'd like to understand consequences of Application.DoEvents call. Does it create a new thread? Thank you
3
by: dotNETDavid | last post by:
We've broken our app into various assemblies. The WinForm assembly provides the user interface, other assemblies provide various I/O services. I'd like to be able to call...
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. ...
7
by: Tym | last post by:
Made the change from vb6 to vb.net and have found that DoEvents() doesn't work!! Well, the replacement System.Windows.Forms.Application.DoEvents() is causing hell!! I have a loop such as
13
by: Amjad | last post by:
Hi, Is there an equivalent to the "Application.Doevents" method in modules or Windows services? I want to make a Windows service that calls a DLL. The DLL would have all my functions and it...
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: ...
11
by: Don | last post by:
I have a WPF application in VB in VSTS 2008 RTM. I am trying to "blink" (momentarily clear) a field of data if the data is reloaded from the database to give the user some visual indication of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.