Click to See Complete Forum and Search --> : Application.DoEvents() Equivailent?


dfb78
January 14th, 2003, 04:09 PM
What is the equivalent of Application.DoEvents() in C# for ASP.NET code (preferably C#)? I am only used to C# in windows applications, but I would like a button to display something immediately after clicking on it ("Please wait..." or something), and it does not appear until the entire method has ended. The Application.DoEvents() method would take care of clearing the queues events in C#, so I thought it would work for a web for as well, but Intellisense doesn't even offer that method. :(

Thanks

mwilliamson
January 14th, 2003, 08:53 PM
You should do your work in another thread. But if you really need to, you can try this:

void DoEvents()
{
MSG msg;
if( GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

its c++ code, but I think it will work in C# too.

dfb78
January 14th, 2003, 09:48 PM
I'm familiar with C++, but not enough to convert the code to a working order. :( I'm assuming it will work, but I am getting a slew of errors when I try to run the app now. Is there a namespace I should include (or reference) in C# you're aware of that may help with this? I think I really just need to find out what "GetMessage" belongs to.

DSJ
January 15th, 2003, 03:56 PM
To display something on the client you'll need to use client side script. The page isn't sent back until all the processing is done on the server's side.

mwilliamson
January 15th, 2003, 08:21 PM
Oh, this is ASP? Why would you need DoEvents in ASP?

dfb78
January 15th, 2003, 09:31 PM
Well, with my limited amount of ASP.NET experience, I have NO idea if it is even possible. I mentioned a DoEvents() method because I am familiar with C#, and it "clears the queue" when called in a Windows app. I've been able to accomplish what I want using JavaScript, but I was curious if it is possible with C# in the page's code.

sager
January 17th, 2003, 05:45 PM
DoEvents is not possible in ASP. all requests made by the client are performed on the server and the results returned. Do not think of it like a typical desktop application.