I have a little problem that my Form gets stuck when I run this first code. I have a lot of code in the event.
The code runs fine but if I now will deactivate the form by clicking with the mouse on the desktop and again click somewhere on the form, the form will "Not respond" and this goes on for about 3 minutes.

// 200 pages of code

Application::DoEvents();
Form2::Update();

Now if I show a MessageBox in the end of the code, click OK, click on the desktop and again clicking on the form, everything works fine and the form respond as it should and doesn´t get stuck.

I dont know why everything works nice when I show a MessageBox. I started to think that I updated the form in somehow by doing that.
This is why I tried Applicaton:: DoEvents() and Form2::Update() in the above code.

I wonder if there would be any other code that fix this like the MessageBox did, peheps some kind of update of the form was done when the messagebox was showed ?

// 200 pages of code

MessageBox::Show("Finish");

Recommended Answers

All 2 Replies

Would you mind posting the entire project zipped (with unneeded compiler generated files excluded) so I can run it and take a closer look.

Thank you, William Hemsworth

I appreciate that very much, the problem is that I cant ´give´ out this code.
However it seemed to be solved if I opened a new Form and closed it in the Load_event.
The whole process and solution seems strange and as I beleive for sure wrong solution but I will go with it for now and see if it works without problem.

Regards
/L

Would you mind posting the entire project zipped (with unneeded compiler generated files excluded) so I can run it and take a closer look.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.