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).
Loading
mark escoPosted Nov 19, 2010, 7:55 AM
Form1 frm1 = new Form1();
Form2 frm2 = new Form2();
frm2.ShowDialog(frm1);
Thanks again everyone =)
Sam HobbsPosted Nov 18, 2010, 4:35 PM
mark escoPosted Nov 18, 2010, 4:17 PM
I started a new project
Named everything the same
and used the same code......This time it worked!
I probably messed up a naming reference deep in the project or something.
Thank you for all your help.
And if there are any newbies(like me) here is the syntax i used to show a form
as a dialog controlled by another form.
Form1 frm1 = new Form1();
Form2 frm2 = new Form2();
frm2.Show(frm1);
Place above code in a button (or some other control)
Thanks again everyone. =)
Sam HobbsPosted Nov 18, 2010, 2:12 PM
mark escoPosted Nov 18, 2010, 9:40 AM
ShankeyPosted Nov 18, 2010, 2:36 AM
I created the application with your code, its working fine, but if your filedialog page getting minimized, then plz check the windowstate property of the filedialog form and change it to normal
please do let me know what you have done to solve your problem