Question: Create a windows form application which consists of a List Box Control and four buttons. Add button : Adds items to the list box Remove
Create a windows form application which consists of a List Box Control and four buttons.
Add button: Adds items to the list box
Remove button: Removes selected items from the list
Clear button: Empties the list
Exit button:Closes the form
private void btnAdd(object sender, EventArgs e)
{
string s = textBox1.Text;
listBox1.Items.Add(s);
}
private void btnRemove(object sender, EventArgs e)
{
if (listBox1.SelectedIndex != -1)
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
ListBoxTest Dog Cat Chicken Cont Add Remove Clear Exit G
Step by Step Solution
3.39 Rating (155 Votes )
There are 3 Steps involved in it
Solution Code Form1cs using System using SystemCollectionsGeneric using SystemComponentModel using SystemData using SystemDrawing using SystemLinq using SystemText using SystemThreadingTasks using Sys... View full answer
Get step-by-step solutions from verified subject matter experts
