Bound Control

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

Hello, when you have bound a datatable to a control, say a comboBox and you
have set the "ValueMember" and the "DisplayMenber". The cbo.SelectedValue
returns the object which equates to the "ValueMember", but how do you
retrieve the object which is associated with the Display Member? I have
tried cbo.SelectedText, but that does not seem to do...I have tried
cbo.SelectedItem...but again does not seem to do it which the control is
bound.

This only way that I have found to get the value is to use the
cbo.SelectedIndex and use this as a pointer back into the DataTable which
is bound to the control. Surely there is a better way....

What is the difference between selected Text and Selected Item?

Thanks in advance for your assistance!!!!!!!!!!!!
 
Hi Jim

Have you tried 'cbo.Items[cbo.SelectedIndex]

thank
Nithin P

----- Jim Heavey wrote: ----

Hello, when you have bound a datatable to a control, say a comboBox and you
have set the "ValueMember" and the "DisplayMenber". The cbo.SelectedValue
returns the object which equates to the "ValueMember", but how do you
retrieve the object which is associated with the Display Member? I have
tried cbo.SelectedText, but that does not seem to do...I have tried
cbo.SelectedItem...but again does not seem to do it which the control is
bound

This only way that I have found to get the value is to use the
cbo.SelectedIndex and use this as a pointer back into the DataTable which
is bound to the control. Surely there is a better way...

What is the difference between selected Text and Selected Item

Thanks in advance for your assistance!!!!!!!!!!!
 
Back
Top