hi
this is faha here im new to c#
I was actually trying to load different textboxes
by multiple selecting a listbox..
I added items to the listbox and then used a for loop to iterate the listbox and accordingly enter the value in the textbox but it isnt working...Any help greatly appreciated..
lb1.Items.AddRange(new string[] {"Engine", "Water", "Air", "Fire" });
LB1 IS THE LIST BOX. This code is in the load method.
In the listbox method i have this code
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
lb1 = listb1;
for (int i = 0; i < lb1.SelectedItems.Count; i++)
{
tb.Text = lb1.SelectedItems[0].ToString();
wt.Text = lb1.SelectedItems[1].ToString();
ft.Text = lb1.SelectedItems[2].ToString();
at.Text = lb1.SelectedItems[3].ToString();
}
This code isnt't working and when it reaches
wt.Text = lb1.SelectedItems[1].ToString();
it throws an indexoutofbound exception
however there are 4 items in da listbox.