Simple focus Q

G

Guest

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
}
 
B

Bruce Wood

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.
 
G

Guest

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
 
B

Bruce Wood

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?
 
B

Bruce Wood

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top