I am having difficulty with a MDI child/parent relationship for my C# winforms project. I currently have a several controls (button, menu strip, etc.) that call the same function to open a new child form.
The main form has the propery of MDI container as it was set on the properties window (not programmatically).
However, when I click on the button, the form does not show up. If I make the form so it is not an MDI child (by commenting the second line of code below), it does pop up just fine...but that's not what I want.
Here is the code that I have for the function. I have just recently added the .focus method because I saw that mentioned on another forum post and it didn't work.
What could I possibly be doing wrong!? Thanks in advance.
The main form has the propery of MDI container as it was set on the properties window (not programmatically).
However, when I click on the button, the form does not show up. If I make the form so it is not an MDI child (by commenting the second line of code below), it does pop up just fine...but that's not what I want.
Here is the code that I have for the function. I have just recently added the .focus method because I saw that mentioned on another forum post and it didn't work.
Code:
frmSearch frmSearch = new frmSearch();
frmSearch.MdiParent = this;
frmSearch.Show();
frmSearch.Focus();
What could I possibly be doing wrong!? Thanks in advance.