How to load usercontrol in splitcontainer.panel2?

.NET Training:

I have a form with a split container, I want to load usercontrol in panel2, but

splitContainer1.Panel2.add(..) 

Does not work.

EDIT working now:

  private void button1_Click(object sender, EventArgs e) { UserControl1 myUserCont = new UserControl1(); splitContainer1.Panel2.Controls.Add(myUserCont); } 
  • How do I load user controls?
  • Will data bindings in usercontrol work when loading into the panel?
  • Panel 1 will display the tree structure of object navigation (data binding). Am I on the right track?

Yours faithfully,

/ T

+4
source share
2 answers

Use this code:

 splitContainer1.Panel2.Controls.Add(...) 
+4
source

Try the following:

  splitContainer1.Panel2.Controls.Add(utcMyTest) 

for unloading:

  splitContainer1.Panel2.Controls.Remove(utcMyTest) 

Hope this helps.

+3
source

Source: https://habr.com/ru/post/1381452/


All Articles