954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Form gets stuck but not when showing a MessageBox in the end of code

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");
Lukezzz
Posting Whiz in Training
268 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

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

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

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.
Lukezzz
Posting Whiz in Training
268 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You