user2349425
user2349425

Reputation: 83

Adding 2 listbox to tabpage

I wanted to add two listbox to a same tabpage. However, when I run the code below, it only add one.

TabPage frontPage = new TabPage();
frontPage.Text = "Summary";
tabControl1.TabPages.Add(frontPage);
ListBox listBox1 = new ListBox();
ListBox listBox2 = new ListBox();
frontPage.Controls.Add(listBox1);
frontPage.Controls.Add(listBox2);

Upvotes: 0

Views: 254

Answers (1)

user2349425
user2349425

Reputation: 83

As suggested by gunr2171, I used a Dock to separate both of them

listBox1.Dock = DockStyle.Left;
listBox2.Dock = DockStyle.Right;

Upvotes: 2

Related Questions