By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 1,800 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

Invoking a child form from another child form

P: 3
Hi,

I have three forms. "Main form" is a container and "Logon Form" is the child of this. I want to invoke another "AppLogin Form" from "Logon Form" as a child form to get the login details to a diff application. How can this be done?

If I make the Logon form as a container, its giving me the error " A form cannot be container and child..... ".Please do reply

Thanks in advance,
KMSDXB
Dec 3 '09 #1
Share this Question
Share on Google+
4 Replies


sanjib65
100+
P: 102
A child window can be a parent of another control.
For example, the Standard toolbar of Visual Studio is the parent of the buttons on it. If you close or hide the toolbar, its children disappear. At the same time, the toolbar is a child of the application's frame. If you close the application, the toolbar disappears, along with its own children. In this example, the toolbar is a child of the frame but is a parent to its buttons.
http://http://www.functionx.com/vbnet/Lesson08.htm

A small example:

Expand|Select|Wrap|Line Numbers
  1. GridView gv = new GridView();
  2. //some code
  3. Panel1.Controls.Add(gv);//here gv is the child control
  4.  
Dec 3 '09 #2

P: 3
Hi,

On invoking the new form from this child form, I'm getting this message:
"Form that was specified to be the MdiParent for this form is not an MdiContainer."

Could you please guide me on this?

The piece of code is as follows:

frmLogin oLogon = new frmLogin();
oLogon.MdiParent = this; //error
oLogon.Show();
where the form frmLogin is set as a child form.
Dec 6 '09 #3

P: 3
Hi,

While invoking the new form from the child form, I'm getting the following error:
"Form that was specified to be the MdiParent for this form is not an MdiContainer."

The code is as follows:

frmLogin oLogon = new frmLogin();
oLogon.TopLevel = false;
oLogon.MdiParent = this;
oLogon.Show();

The form frmLogin is the new child form to be invoked from the current form which itself is a child.

Please guide me on this.
Dec 6 '09 #4

P: 7
The error says it all, you need to creat and MDI Primary Form which will be parent for all the other forms.
Dec 11 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.