471,317 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

Simple focus Q

Form1() has a selection menu for the user. Form1() calls Form2() with menu
selections. Form2 opens a Crystal Report viewer. How do I this.Close()
the Form1 properly so the user doesn't have access to the previous selection
menu when the CR viewer opens. Currently, the menu stays open behind the
viewer. Or, am I missing something.

//button on Form1
private void okButton_Click(...)
{
Form2 form2 = new Form2(selections);
form2.ShowDialog(); //allows CR viewer to open
}
Dec 30 '05 #1
4 1022
I wouldn't try to Close the first form, as such. Just do a this.Hide()
to make it invisible while the viewer is up, then this.Close() it after
the form2.ShowDialog() call returns.

Dec 30 '05 #2
Thanks Bruce appears to work fine. I thought I looked for Hide()

Anyways, can I test for a showdialog() returns. I ask because I have a dll
that won't close ...sometimes .. and it remains open on the server and I have
to go to the server to close/end it. There are no threads.

Steve

"Bruce Wood" wrote:
I wouldn't try to Close the first form, as such. Just do a this.Hide()
to make it invisible while the viewer is up, then this.Close() it after
the form2.ShowDialog() call returns.

Dec 30 '05 #3
Hmm. I assume that you're using WebForms and ASP.NET. In that case I
can't help you... I'm strictly a WinForms guy for the present. Maybe
someone else can jump in?

Dec 30 '05 #4
Oh, hey... I just had an idea.

Are you doing a Dispose() after ShowDialog() returns?

form2.ShowDialog();
.... get whatever information you need from form2 ...
form2.Dispose();

? That could account for your DLL being left open, if form2 uses it.

Dec 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Bruce Duncan | last post: by
6 posts views Thread by nizar.jouini | last post: by
3 posts views Thread by Marc Llenas | last post: by
11 posts views Thread by greg.scharlemann | last post: by
4 posts views Thread by Rodrigo Ferreira | last post: by
rnd me
reply views Thread by rnd me | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.