mark esco

mark esco

  • NA
  • 12
  • 0

Simple Form Problem(hopefully)

Nov 17 2010 8:59 PM
I am brand new to C# and am having problems. I need my Main form to open my FileDialog
form. I need the file dialog box to stay on top of my Main form(Preferably not on top of other
applications forms, but i can live with out this). I need the FileDialog form to be a child ( not MDI)
of the first form (a modal, I believe it is called). I tried Google, Microsoft, various others, and
I know it's something simple I am overlooking.

Here is my code. I have 2 designed forms frmMain and frmFileImport.

 frmFileImport FileDialog = new frmFileImport();
 frmMain MainForm = new frmMain();
 FileDialog.TopMost = true; 
 FileDialog.ShowDialog(MainForm);

The new form gets created (automatically minimized for some reason) and is just like any
plain form. I can keep clicking my Main form button(the one that opens the FileDialog) and
new FileDialofg window will appear. I only want one FileDialog and have my Main form locked
until FialDialog closes!

I am using Visual C# Express 2010. I think in VB its just frmName.Show(OwnerName).

Answers (6)