开发者

Set ItemsSource to DataTable Item

I am trying to set the itemssource for my WPF-based VB 2010 project to a datatable item. The datatable is "roster_table" and the column na开发者_如何学运维me I want to display the items from in the list box is "DATA_NAME". The listbox is "lstNames".

My apologies if this is a dumb question, but I can't find a straight answer anywhere. How do I set the itemssource for the listbox to the datatable's column, as described above?


try this

lstNames.ItemsSource = roster_table;
lstNames.DisplayMemberPath = "DATA_NAME";

to set value to the item

lstNames.SelectedValuePath = "YOUR_ID";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜