469,269 Members | 1,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,269 developers. It's quick & easy.

ListBox Selected Values

Hi, I am using C#.Net Win Apps and I want to get the ID values which is bind to a listbox thru a loop???? ie. listbox's selectedvalue property.......? how it is possible to get all the selected items's selected value???? pls help me....
Jul 5 '07 #1
3 3056
TRScheel
638 Expert 512MB
Hi, I am using C#.Net Win Apps and I want to get the ID values which is bind to a listbox thru a loop???? ie. listbox's selectedvalue property.......? how it is possible to get all the selected items's selected value???? pls help me....
I am having difficulty understanding your problem. Perhaps it would be helpful if you showed some code and reiterated your question?
Jul 5 '07 #2
Hi, thanks for the reply.....suppose that in the database there are two feilds such as Item_id and item_name. And i did a data binding it to a listbox as shown below....

datatable dt=conobj.GetDataTable("select * from tbl_Items");
listbox.datasource=dt;
listbox.displaymember=item_name;
listbox.valuemember=item_id;

after binding..how how we get the id values from the selected items of the listbox??? am using C#.Net 2 win apps....thnaks in advance..........
Jul 6 '07 #3
Vidhura
99
Hi, thanks for the reply.....suppose that in the database there are two feilds such as Item_id and item_name. And i did a data binding it to a listbox as shown below....

datatable dt=conobj.GetDataTable("select * from tbl_Items");
listbox.datasource=dt;
listbox.displaymember=item_name;
listbox.valuemember=item_id;

after binding..how how we get the id values from the selected items of the listbox??? am using C#.Net 2 win apps....thnaks in advance..........

listBox1.SelectedValue
Jul 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Vipin Kedia | last post: by
2 posts views Thread by Sally | last post: by
6 posts views Thread by Janaka | last post: by
2 posts views Thread by John | last post: by
3 posts views Thread by Mitch | last post: by
5 posts views Thread by =?Utf-8?B?QmlnU2Ft?= | last post: by
6 posts views Thread by Pippen | last post: by
reply views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.