i have listbox control and i have to display selected item in the listbox.
some one send the code. the code like below
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
textBox1.Clear();
foreach (object selectedItem in listBox1.SelectedItems)
{
textBox1.AppendText(selectedItem.ToString() + Environment.NewLine);
}
}
but it is giving errow at foreach please help me