Click here to Skip to main content
15,920,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem, I want to show Form A in Form B and access Form A controls on Form B without opening Form A up? Please Help
Posted
Comments
Kschuler 8-Feb-12 12:26pm    
Could you explain more? What do you mean show Form A in Form B? You want the entire form to display inside another form? Or do you want another instance of Form A to appear? Why wouldn't you want to just show Form A? Perhaps there is a better way to accomplish the task, and we could help you if you explained more about what you are trying to do.
BillWoodruff 8-Feb-12 21:14pm    
"access Form A controls on Form B without opening Form A up?" this makes no sense: please explain what you are trying to do here. By "opening up" Form A: do you mean accessing Form A controls when they are not visible, because, even though you've created Form A in Form B, and set Form B to be Form A's parent: you have never called 'Show on Form A.

What possible purpose could be served by accessing "invisible controls" ?
[no name] 9-Feb-12 1:44am    
plz clarify your question...i didnt understan what is your requirements...

Hi,

You may visit this link http://www.codeincsharp.blogspot.com/search/label/MDIForm

I hope this one can help you.

Thank You.
 
Share this answer
 
Hi,

You may visit this link http://www.codeincsharp.blogspot.com/search/label/MDIForm

I hope this one can help you.

Thank You.
 
Share this answer
 
add a Button (button1) and a Panel (panel1) on your main form.
FormA is that as you said.
add following code on button1.click event.

C#
private void button1_Click(object sender, EventArgs e) {
    FormA frm = new FormA();
    frm.TopLevel = false;
    frm.Parent = this.panel1;
    frm.Dock = DockStyle.Fill;
    frm.Show();
}


is this what you want?
 
Share this answer
 
Comments
KRImmELS 9-Feb-12 11:06am    
Yes that is exactly what I want thank you so much
I want to display the whole of Form A in a place in Form B, Form B is my main Form and want to show Form A in Form B to access data and edit data on Form A without showing form A as a new form, it's something new to me.
 
Share this answer
 
Comments
Silent Guardian 8-Feb-12 14:09pm    
add explanation of question in comment area not in solution area
Dave Kreskowiak 8-Feb-12 16:12pm    
That is a horrible design. You say you want to "display the whole of Form A" inside Form B. OK, not something I would do because Form A will be movable inside Form B and work exactly like it was on its own.

A better option would be to make a user control or set of controls that can be used by both Form B and Form A without having Form A try to perform the tasks of both a seperate form and a control on another form.
u can achieve it by using .hide() and .show() method of each form.

create a new thread for the new form if u want both forms to work asynchronously.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900