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.AddRa nge(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_Select edIndexChanged( object sender, EventArgs e)
{
lb1 = listb1;
for (int i = 0; i < lb1.SelectedIte ms.Count; i++)
{
tb.Text = lb1.SelectedIte ms[0].ToString();
wt.Text = lb1.SelectedIte ms[1].ToString();
ft.Text = lb1.SelectedIte ms[2].ToString();
at.Text = lb1.SelectedIte ms[3].ToString();
}
This code isnt't working and when it reaches
wt.Text = lb1.SelectedIte ms[1].ToString();
it throws an indexoutofbound exception
however there are 4 items in da listbox.
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.AddRa nge(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_Select edIndexChanged( object sender, EventArgs e)
{
lb1 = listb1;
for (int i = 0; i < lb1.SelectedIte ms.Count; i++)
{
tb.Text = lb1.SelectedIte ms[0].ToString();
wt.Text = lb1.SelectedIte ms[1].ToString();
ft.Text = lb1.SelectedIte ms[2].ToString();
at.Text = lb1.SelectedIte ms[3].ToString();
}
This code isnt't working and when it reaches
wt.Text = lb1.SelectedIte ms[1].ToString();
it throws an indexoutofbound exception
however there are 4 items in da listbox.
Comment