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

Application.DoEvents

Hello:

I have created a component in which I need to do a timeout operation. What
is the equivalent to Application.DoEvents() in a Component.

public virtual bool ReceiveResponse( out string aResponseString, int
aTimeoutInterval )
{
bool aTimeout = false
while ( ( ResponseList.Count = 0 ) && ( !aTimeout ) )
{
// with for the list to get a response.

// this won't work for a component
Application.DoEvents();

// do processing for timeout interval
if ( reached atimeout )
{
aTimeout = true;
}
}

if ( !aTimeout )
{
//process the response
}
else
{
// fire timeout error
}

return aResponse;
}

Thanks
Bob
Nov 15 '05 #1
2 11130
Hi Bob,

Why won't Application.DoEventswork?
Anyway, you should really consider processing it in another thread.
See
Safe, Simple Multithreading in Windows Forms (there are three parts) for
more info.
http://msdn.microsoft.com/library/de...ms01232003.asp

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Bob lazarchik" <bo*****@yahoo.com> wrote in message
news:uk*************@TK2MSFTNGP12.phx.gbl...
Hello:

I have created a component in which I need to do a timeout operation. What is the equivalent to Application.DoEvents() in a Component.

public virtual bool ReceiveResponse( out string aResponseString, int
aTimeoutInterval )
{
bool aTimeout = false
while ( ( ResponseList.Count = 0 ) && ( !aTimeout ) )
{
// with for the list to get a response.

// this won't work for a component
Application.DoEvents();

// do processing for timeout interval
if ( reached atimeout )
{
aTimeout = true;
}
}

if ( !aTimeout )
{
//process the response
}
else
{
// fire timeout error
}

return aResponse;
}

Thanks
Bob

Nov 15 '05 #2
Bob lazarchik <bo*****@yahoo.com> wrote:
I have created a component in which I need to do a timeout operation. What
is the equivalent to Application.DoEvents() in a Component.


The most appropriate thing is to do your work in another thread instead
of using DoEvents in the first place.

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

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
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...
1
by: Viet | last post by:
I don't know if this is the right forum for my question but here goes: I am converting a VB6 app to VB.NET and I would like to use Threads and Threadpools. This main app (1) executes two other sub...
0
by: Ralf Gedrat | last post by:
Hello! I have a Application, this throws after some time following exception: Item has already been added. Key in dictionary: "- 1" key being added: "- 1" I use Application.Run with...
1
by: RSH | last post by:
I created a new Windows Form project and I created a simple richtextbox to write to and I am looping through a simple example but obviously the screen isn't updated it only shows the first...
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...
5
by: james.jdunne | last post by:
System.ArgumentException: Item has already been added. Key in dictionary: "-1" Key being added: "-1" at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at...
4
by: Woo Mun Foong | last post by:
Hi, I have a DLL that is used to carry out some lengthly process. I would like to have something similar to DoEvents that can yield control back to Windows every now and then. Any ideas ? ...
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...
3
by: Sathyaish | last post by:
From inside a class library, in a WPF application, I wish to get a handle to an object, any object, may be the System.Windows.Application object that supports a method such as DoEvents() by calling...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.