BoulderBum
Programmer
I'm going a little nuts trying to figure out combo box binding. I figured out that I have to move the DataSource code above the DisplayMember and ValueMember declarations, but when I try to access SelectedItem or SelectedValue, all I get is System.Data.DataRowView.
What am I doing wrong?
What am I doing wrong?
Code:
lbParameters.DataSource = ds.Tables[0]; //ds is a DataSet
lbParameters.DisplayMember = "field_text";
lbParameters.ValueMember = "type_description";
...
private void lbParameters_SelectedIndexChanged(object sender, System.EventArgs e)
{
if( lbParameters.SelectedIndex != -1 )
{
Debug.WriteLine( lbParameters.SelectedItem.ToString() );