Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have one parent form.On that Form i have one button,when i click that button a child form opens as dialog box.but if any application is running suppose web browser in background than main form hides and than child form opens on that application.how i do stop it to close parent form when any application is running behind
Posted
Updated 6-Jan-12 1:45am
v2

1 solution

try

C#
yourform frm=new yourform();
frm.show();
frm.mdiparent=this;
 
Share this answer
 
Comments
jaideep06.jd 6-Jan-12 8:00am    
actually i have one architecture in thaat if use frm.show it open it in new tab
i want to use it with form.ShowDialog(); but still have same problem
devbtl 6-Jan-12 8:03am    
put some piece of code here dude.
jaideep06.jd 6-Jan-12 8:10am    
private static DialogResult<TForm> ShowForm<TForm>(Form form, bool modelLess) where TForm : Form
{
var retval = new DialogResult<TForm> {DialogResult = DialogResult.No, Form = (TForm) form};

form.StartPosition = FormStartPosition.CenterParent;

if (modelLess)
{
form.MdiParent = MainForm;
if (MainForm == null)
{

form.Size = new Size(700, 590);
}
form.Show();
}
else
{
form.ShowInTaskbar = false;
(new FormSizeManager(form)).LoadFormSize();
form.TopLevel = true;
form.Focus();
retval.DialogResult = form.ShowDialog(MainForm);

//form.BringToFront();
}
return retval;
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900