|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
MDIParent propertyHi all,
I'm opening a mdichild (Form2) within another mdichild (Form1). In Form1 I have: Form2.MdiParent = Me.MdiParent 'No problem here .... .... If Form2.ShowDialog = DialogResult.OK Then 'I get an error message here. This is the error: Forms that are not top level forms cannot be displayed as modal dialog. Remove the form from any parent form before calling ShowDialog. When I remove: Form2.MdiParent = Me.MdiParent Then I don't get error message but the MDIParent value for Form2 is nothing. I need to assign mdiparent to the form2 and at the same time use ShowDialog. Does anyone have any suggestions? Thanks in advance, Roy Roy wrote:
> I need to assign mdiparent to the form2 and at the same time MDI child forms cannot be displayed as Dialog forms, hence the error you are > use ShowDialog. Does anyone have any suggestions? getting. One way you could fix this is to add a public property to Form2, which allows you to set the MDI form, like this: \\\ Public MyMainMDIForm As Form /// ....then in your code in Form1, instead of setting the MdiParent, set the MyMainMDIForm property instead. This will stop VB from thinking your form should be an MDI child, and will allow ShowDialog() to work. When Form2 needs access to the MDI form, it can access it through the MyMainMDIForm reference instead of through the MdiParent property. Hope that helps, -- (O)enone
ASCII lookup table
Datagrid resizing rows on sort - not wanted Datagrid - shown vertically instead of horizontally? Reading from a ini-file and run a program Easy one about web forms How do I measure the time it takes to copy a file? step by step guide to databinding? Positioning a Web Control - Runtime Registering my program as default for my file extension Inherited Treeview control with dynamic context menu. |
|||||||||||||||||||||||