ListBox DataBinding, ValueMember?
-
(Hello Paresh! I'm sure you will answer...) For simple things, DataBinding is a cool thing; Now I saw that there is a easy property to bind a DataSource with a key in the datatable: list.DataSource=m_workset.Projekte; list.DisplayMember="projekttext"; list.ValueMember="projektid"; Looks good but I didn't find how to get then this Value out of an item - say by double-click on an item. Does anybody knows hot to get this valuemember out of an listboxitem? Thanks! Stefan
-
(Hello Paresh! I'm sure you will answer...) For simple things, DataBinding is a cool thing; Now I saw that there is a easy property to bind a DataSource with a key in the datatable: list.DataSource=m_workset.Projekte; list.DisplayMember="projekttext"; list.ValueMember="projektid"; Looks good but I didn't find how to get then this Value out of an item - say by double-click on an item. Does anybody knows hot to get this valuemember out of an listboxitem? Thanks! Stefan
I hope this is wath you mean... textBox1.Text = list.SelectedValue; or... textBox1.Text = list.SelectedValue.ToString(); now you have 'list.ValueMember' in textBox1 or any other control or variable you may have, i hope this helps. Signature hmmmmm..... I look for it at home.... tomorrow.
-
I hope this is wath you mean... textBox1.Text = list.SelectedValue; or... textBox1.Text = list.SelectedValue.ToString(); now you have 'list.ValueMember' in textBox1 or any other control or variable you may have, i hope this helps. Signature hmmmmm..... I look for it at home.... tomorrow.