tags:

views:

95

answers:

4

Scenario

I have a C# WinForms application with a main form. I also have a button on this main form, that, when clicked, creates and displays a new form.

The problem....

...Is that I cannot click on anything on the main form when the new form is open.

The Question

How do I solve this? Is it possible to use both forms simultaneously?

Code To Launch New Form

    private void barBtnStatsMonitor_ItemClick(object sender,   DevExpress.XtraBars.ItemClickEventArgs e)
    {
        //XtraMessageBox.Show("This Feature Has Not Been Fully Implemented Yet!");

        using (StatsMonitorForm frm = new StatsMonitorForm())
        {
            if (frm.ShowDialog() == DialogResult.OK)
            {

            }
        }
    }
+3  A: 

Try frm.Show instead of ShowDialog. ShowDialog opens the new form as a modal dialog so you cannot access the base form until you close this one.

Adrian Faciu
+4  A: 

ShowDialog() opens a modal dialog.

Show() opens non-modal.

Mitch Wheat
A: 

when closing the main form its like closing the app...

so a suggestion would be, disable the main form close button when there are child forms open... and just enable it again when there are no child forms open...

or create a global variable(a bool perhaps), that when a child form is open.. its set to true... so when pressing the close button on the main form... it checks this variable if its true it prompts to save.. else it just closes...

A: 

ShowDialog() displays the form in MODAL mode which means you must close new form opened.

    private void barBtnStatsMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) 
    { 
        //XtraMessageBox.Show("This Feature Has Not Been Fully Implemented Yet!"); 

        using (StatsMonitorForm frm = new StatsMonitorForm()) 
        { 
            frm.Show();
            //do some work here to get the dialog result some other way..
        } 
    } 
this. __curious_geek