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
How to add items to Tab Page
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Oct 17, 2012, 9:20 PM EDT
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
bagzli36 reputationPosted Oct 20, 2012, 2:26 PM EDT