Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to control a child Form? 1

Status
Not open for further replies.

russland

Programmer
Jan 9, 2003
315
CH
Hi,

I'm new with C# and trying to create a child window as we have it when clicking the "Internet Options ..." of the Internet Explorer. This parent child window cannot get the focus as long the child window is up.

How do you do approach this?

I set the isMdiParent of my main form to "true" and coded the following lines when klicking a button. Unfortunately this doesn't work. Opening it just as a regular window works great. Any clue? I appreciate any hint. Thanks

----------------------------------
MyForm flc = new MyForm();
flc.MdiParent = this;
flc.Show();
flc.Focus();
----------------------------------
 
You seem to be after a modal form, for which you can use any form. When you show the form use .ShowDialog instead of .Show.


Hope this helps.

[vampire][bat]
 
Yes, that does better!
Thanks buddy. U got the star.

MyForm flc = new MyForm();
try
{
flc.ShowDialog(this);
}
catch (System.Exception ex)
{
Console.Out.WriteLine("FAILED: " + ex.Message.ToString());
}
 
Why do you need the try catch block ? What possible error could occur when you call the .ShowDialog() ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top