MessageBox.Show can ideally be used only with a UI. Though u are not getting a compile time error because u are referring to System.windows.Forms namespace. But the freezing happens because this is a invalid operation.
Where would the Rendering of the message box happen?? There is no container to have it..
Soln: Add a new form to the project. Set it as the startup object and then u can display the message box.
Main Topics
Browse All Topics





by: LacutahPosted on 2005-04-02 at 00:55:49ID: 13687082
Short recomendation from experience, although not a good explination:
Never show a messagebox (or, as a rule of thumb, try to make parts of the user interface repaint) before a form is loaded. Calling messagebox.show (or the rule of thumb) before a form is loaded seems to cause all sorts of havoc in general.
Again, sorry for no explination, but from experience, it just doesn't work the way I (we) would expect. I've had similar problems when loading a MDI child form and with main forms, and trying to do stuff with objects on the form that would directly affect the display seems to cause lots of headache. Since I don't have a good explination, it's kinda something you've got to experience for yourself, although I'd love to get the actual reason behind why it causes problems.