Ok, adding items to a listbox control is easy. You use Add method of the control. The following code shows you how to do so.Drag a ListBox control on a form and use the following code to add items to the control.
Source Code:private void Form1_Load(object sender, System.EventArgs e){string str = "First item";int i = 23;float flt = 34.98f; listBox1.Items.Add(str);listBox1.Items.Add(i.ToString());listBox1.Items.Add(flt.ToString());listBox1.Items.Add("Last Item in the List Box");}
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: