get the row of a dataset bound to a combobox

G

Guest

Hi everyone,

I've bound a dataset to a combox.
When I select a value from that combobox, I want the values from the whole
row of the dataset/table, not only the DisplayText.
How can I do that?

thanks

Filip
 
R

Ritesh Jain via DotNetMonster.com

Hi,
U can write this code to get the Value of other columns ..........

Code for Binding combo ................
ComboBox1.DataSource = pi_dtTemplate
ComboBox1.DisplayMember = "DisplayMember "
ComboBox1.ValueMember = "ValueMember "


and u can Get the Value of other column using ...............

MessageBox.Show(BindingContext

(ComboBox1.DataSource).Current.Item("OtherColumn"))

I hope this will help u................

Regards,
Ritesh
 
G

Guest

sorry, but

MessageBox.Show(BindingContext(ComboBox1.DataSource).Current.Item("OtherColumn"))

doesn't wrok. The erros is that BindingContext is a property and not a method
 
D

Diego Deberdt

You can call SelectedValue() and typecast the return value to either DataRow
or DataRowView. I can't remember which of the two so check it out...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top