Get valueMember value from BindingSource or aBindingSource.Current

A

a s

Hi everyone,
I have a BindingSource as a DataSource for my control, I have set DisplayMember and ValueMember properties, and I was wondering how can i get a value from a ValueMember field for a currently selected item?

I tried something like...
DataRowView datRow = (DataRowView)myBindingSource.Current

but from here on I'm stuck...I tried to use something like...

((DataRowView)myBindingSource.Current).Row["myColumn"]

But it didn't work...so I was wondering if I someone could guide me towards my solution, or some link with good explanation of BindingSource concept...

Thnx.
 
D

Dathan

Hi everyone,
I have a BindingSource as a DataSource for my control, I have set DisplayMember and ValueMember properties, and I was wondering how can i get a value from a ValueMember field for a currently selected item?

I tried something like...
DataRowView datRow = (DataRowView)myBindingSource.Current

but from here on I'm stuck...I tried to use something like...

((DataRowView)myBindingSource.Current).Row["myColumn"]

But it didn't work...so I was wondering if I someone could guide me towards my solution, or some link with good explanation of BindingSource concept...

Thnx.

Try ((DataRowView)myBindingSource.Current).Row.Item["myColumn"]. I
believe it should do the trick.

~Dathan
 

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