at beginning i want to say sorry for next DoEvents topic, i searched forum but i didn't find answers...
i have some simple mouse click event:
private:
System::Void button1_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
for(int u=0; u<2000;u++){
...long loop
Application::DoEvents();
}
}
thing is that after clicking button application response (for eg. clicking another button...) at second time, at any first action it animates clickling button1, it's weird cause mouse cursor isn't even on it,
i tried also this->Refresh(); instead but this didn't want to work completely...

DoEvents()
rkdayan
George Jodry
First, it sounds like you need a seperate thread to perform your loop. My guess is, you're doing some intensive work in there.
Second, if you truly are doing an intensive amount of work and the reason you're doing a DoEvents (and Refresh) call (which is common in VB apps, albeit not the best method) is to provide your user with a more interactive UI while the code is executing, then I think calling DoEvents is the wrong way to do it.
If both of those are true or somewhat true, then you should implement a seperate thread on carrying out your loop. You can create your own or even use the new BackgroundWorker in .NET2.0.
If you intend to keep the loop within that function, then my only question is, is how long do you wait before clicking the 2nd button Do you give it enough time to finish the block of code that's inside button1_MouseClick
There's also a warning on msdn that it may cause code to be re-entered if the event that it processes in raises an invent:
Exact verbage:
"Calling this method can cause code to be re-entered if a message raises an event."
http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx
Chandra Sekhar M
whole loop takes about 8minutes,
it gets data by http and process it, to some tables and some other things,
second button was made for breaking that process...
Siddhesh Bhobe
ok, thanks for help
i'll look on this threading thing