Hi !
I think both of your problems are explained by the fact how VWG is designed. You have to think of it as a kind of two seperate processes. Say you are running something like the following two psaudo-code lines in a handler, like the button click handler:
a) MessageBox.Show("something")
b) DoSomethingQuiteDifferent()
Ok, This code is running on the server, so the server processes the a) line and here is where most of us drop out and think as it's a messagebox then it will show immediately in the browser, but that does not happen. The server continues to the end of the handler and finishes the b) line before something starts happening in the browser.
I think this is best eplained by referencing your sample app. Take a look at frmChildForm and the button click handler, because there is where you make this common logical error. Your code is:
private void btnLastMessageBox_Click(object sender, EventArgs e)
{
MessageBox.Show("This MessageBox never appears on screen, no matter what you do.",
"Test", MessageBoxButtons.YesNo, new EventHandler(MessageBox_Close));
if (OnCloseFunction != null)
OnCloseFunction();
this.Close();
}
What happens here is the server processes (runs) the MessageBox.Show() and then BEFORE anything happens on the client, it calls the OnCloseFunction delegate, which should display another messagebox and then finally it calls this.Close()... all this is done BEFORE anything has a chance to be reflected in the browser.
Finally the server starts reflecting the changes to the browser, but as you allready closed the form in the handler, there is actually nothing to do other than just close the form ... this is probably a VWG design issue, that MessageBox windows are some kind of "child" of the main window, so when the main window (your frmChildWindow) is allready closed, it will not display the messagebox.
I think you'll have a good time :-) figuring out the other stuff, but to make the "This MessageBox never appears on screen..:" messagebox actually show on screen, just move this code:
if (OnCloseFunction != null)
OnCloseFunction();
this.Close();
From the button click handler to the MessageBox_Close() event handler and then it will work.
Hope this explains the actual meaning of "... Modal windows in VWG are only modal on the client ..." statement that so often has been thrown on the forums :-)
Palli