471,592 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,592 software developers and data experts.

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 3107
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
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.