I have a listbox control, and i want to select all the elements present in the listbox and to store them in a list collection. I need this because my reqirement is to send all the elements to another class.
pls help me..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vishal GilbilePosted Apr 8, 2013, 5:02 AM
you could try the following.
List
for(int i=0;i
lst.Add(listbox1.Items[i].Text);
}
Hope that solves your problem.
With Regards,
Vishal Gilbile
Vishal GilbilePosted Apr 8, 2013, 5:44 AM
Kindly mark the answer as accepted if it had helped you.
With Regard,
Vishal Gilbile
santosh paridaPosted Apr 8, 2013, 5:34 AM
Vishal GilbilePosted Apr 8, 2013, 5:31 AM
Once you got the list you can send it in multiple ways.For eg:- You could create a constructor in your second class which accepts a List
I think that solves your problem.
With Regards,
Vishal Gilbile.
santosh paridaPosted Apr 8, 2013, 5:23 AM