Hello,
I can't seem to figure out, but how can I through code in C# add a list box to a tab page?
Regards,
Bagzli
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Oct 18, 2012, 1:20 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void tabPage1_Enter(object sender, EventArgs e)
{
ListBox listBox1 = new ListBox();
listBox1.Location = new System.Drawing.Point(49, 56);
listBox1.Name = "ListBox1";
listBox1.Size = new System.Drawing.Size(100, 100);
listBox1.BackColor = System.Drawing.Color.Orange;
listBox1.ForeColor = System.Drawing.Color.Black;
tabPage2.Controls.Add(listBox1);
}
}
}
Thanks
bagzliPosted Oct 20, 2012, 6:26 PM