My main application is called "MainForm" which the first thing that happens is it opens "SubEvents" inside the MdiContainer. The problem is that when a action is preformed on the SubEvents form and another form should open, I can not seem to get it to open in the same MainForm MdiContainer.
Inside SubEvents I tried to use the following code which produces a error.
SubEventInformation frmSubEventInformation = new SubEventInformation();
frmSubEventInformation.MdiParent = MainForm;
frmSubEventInformation.Show();
The error is on "frmSubEventInformation.MdiParent = MainForm;"
Error 6 'BoxOffice.MainForm' is a 'type' but is used like a 'variable'

1 answers
Mainform is a type. If that is inside the mainform class it should be mdiparent = this. Or if not just point to a instance of mainform
answered 2 years ago by:
0
I tried changing the code to the below code, but it gives me a error as "Form that was specified to be the MdiParent for this form is not an MdiContainer." Which my understanding since the code is inserted into SubEvents form (which is not the main MdiContainer form) its trying to open SubEventInformation inside SubEvents. It should open the form inside MainForm.
SubEventInformation frmSubEventInformation = new SubEventInformation();
frmSubEventInformation.MdiParent = this;
frmSubEventInformation.Show();
answered 2 years ago by:
0
it`s simple..for default the IsMDiProperty is set to false so..what you hve to do is to set that property to true
in the property window for that form..youselect that property and set to true
it should work
answered 2 years ago by:
0
I know how to set something to be the MdiParent. Let me try and explain this a little easier.
I have a main form MainForm which is the MdiParent for all sub forms. When MainForm opens its default form to open is SubEvents. Inside the form SubEvents when a user clicks on a item in a list on SubEvents, it should open SubEventInformation inside MainForm, NOT inside SubEvents
answered 2 years ago by:
0
Nevermind I figured it out... looks like I needed this code
SubEventInformation frmSubEventInformation = new SubEventInformation();
frmSubEventInformation.MdiParent = MainForm.ActiveForm;
frmSubEventInformation.Show();
answered 2 years ago by:
0
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!