Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to add items into list?

Status
Not open for further replies.

Jsd02

Programmer
Apr 21, 2002
12
EE
I have a simple C# project, there's a list box & button, how to add new entry into listbox when I click at buton?
 
From the MSDN ListBox.ObjectCollection class documentation:

Code:
// Delay displaying the new items
listBox1.BeginUpdate();

// Loop through and add 50 items to the ListBox.
for (int x = 1; x <= 50; x++) {
   listBox1.Items.Add(&quot;Item &quot; + x.ToString());
}

// Allow the ListBox to repaint and display the new items.
listBox1.EndUpdate();

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top