0

I have multiple form application in vb.net Now i rose to a condition where i want to display one Form in the Groupbox/Panel control of other form. Is there any way to achieve that??? Any help is appreciated..

Vijay
  • 81
  • 1
  • 4
  • 14

2 Answers2

1

If you must, you can do that. Here is an example:

Dim f As New Form
f.TopLevel = False
f.FormBorderStyle = FormBorderStyle.None
f.Dock = DockStyle.Fill
f.Visible = True
Panel1.Controls.Add(f)

The TopLevel = False is a requirement. Setting the FormBorderStyle and Dock style are optional, but probably what you are looking to do.

LarsTech
  • 80,625
  • 14
  • 153
  • 225
  • Now i have to explore my condition, i have one tab strip control having two tabs. On one tab i have Panel control where i have showed another form and this other form have one button "Submit". On other tab i have some controls and one button "OK". Now on clicking "OK" button i have to call the click event of "Submit" button of the form on panel on other tab.. So how can i achieve that?? Any help is appriciated... – Vijay May 22 '12 at 10:45
  • @Vijay I can't see your code from here, but you are asking a different question. Stack Overflow is for one question at a time. That being said, their are a lot of examples to do what you are asking here. The simple thing is to have a reference to your form that contains the submit button, and just call it directly, example: `f.submitButton_Click(nothing, nothing)`. – LarsTech May 22 '12 at 12:09
  • thanks Lars.. i got solution with addhandler. Thank you for ur concern. it means lot to me.. – Vijay May 22 '12 at 13:18
0

You cannot put Form on another Form - use User Control for that.

see

User Control vs. Windows Form

Community
  • 1
  • 1
  • I always do that, it is not a problem to put a form on another form, but you need to set `f.TopLevel = False` – Nick May 10 '12 at 02:43