Databinding Question

  • Thread starter Thread starter Darin
  • Start date Start date
D

Darin

Hi,

In my app I am trying to bind a dataset to a combo box and I am having some
trouble. In the combo box it shows this "System.Data.DataRowView" for each
record. It is showing the correct number of records. I am calling a stored
procedure in Access with a parameter. It seems to run fine. Any ideas?
 
You need to set your Display Member on the ComboBox control.

myComboBox.DisplayMember = "myDataSet.MyDataTable.Column whoms text needs to
be displayed"
 
Thanks for your response. I do that in the following code:

this.sizecombobox.DataSource = ds.Tables["tblModelProbe"];
this.modelComboBox.DisplayMember = "strProbeSizeID";

I have other combo boxes working however this is the first one with a stored
procedure with a parameter. When debugging I can see the dataSet has the
correct data. Any other ideas?

Thanks again
 
I've never used Access, however I do not think this is your problem as you
state the DataTable looks correct. So, you have a DataTable that is bound
to a combobox. You set the DataSource, DisplayMember and the Value Memebr
and then you add to the BindingsCollection using the SelectedValue property?
Darin said:
Thanks for your response. I do that in the following code:

this.sizecombobox.DataSource = ds.Tables["tblModelProbe"];
this.modelComboBox.DisplayMember = "strProbeSizeID";

I have other combo boxes working however this is the first one with a stored
procedure with a parameter. When debugging I can see the dataSet has the
correct data. Any other ideas?

Thanks again

Greg said:
You need to set your Display Member on the ComboBox control.

myComboBox.DisplayMember = "myDataSet.MyDataTable.Column whoms text
needs
to
be displayed"
 
this.sizecombobox.DataSource = ds.Tables["tblModelProbe"];
this.modelComboBox.DisplayMember = "strProbeSizeID";


these are 2 different comboboxes

Darin said:
Thanks for your response. I do that in the following code:

this.sizecombobox.DataSource = ds.Tables["tblModelProbe"];
this.modelComboBox.DisplayMember = "strProbeSizeID";

I have other combo boxes working however this is the first one with a stored
procedure with a parameter. When debugging I can see the dataSet has the
correct data. Any other ideas?

Thanks again

Greg said:
You need to set your Display Member on the ComboBox control.

myComboBox.DisplayMember = "myDataSet.MyDataTable.Column whoms text
needs
to
be displayed"
 
Thanks for your response. No I do not set the Value Member or
BindingsCollection. I am new to ADO.Net so bear with me. The DataSet is a
simple one where it is one table with one column. In the other combo boxes
that I data bind are simple too and I do not set the Value Member or
BindingsCollection. Could you explain why I need to?

Thanks

Greg said:
I've never used Access, however I do not think this is your problem as you
state the DataTable looks correct. So, you have a DataTable that is bound
to a combobox. You set the DataSource, DisplayMember and the Value Memebr
and then you add to the BindingsCollection using the SelectedValue property?
Darin said:
Thanks for your response. I do that in the following code:

this.sizecombobox.DataSource = ds.Tables["tblModelProbe"];
this.modelComboBox.DisplayMember = "strProbeSizeID";

I have other combo boxes working however this is the first one with a stored
procedure with a parameter. When debugging I can see the dataSet has the
correct data. Any other ideas?

Thanks again

Greg said:
You need to set your Display Member on the ComboBox control.

myComboBox.DisplayMember = "myDataSet.MyDataTable.Column whoms text
needs
to
be displayed"

Hi,

In my app I am trying to bind a dataset to a combo box and I am having
some
trouble. In the combo box it shows this "System.Data.DataRowView" for
each
record. It is showing the correct number of records. I am calling a
stored
procedure in Access with a parameter. It seems to run fine. Any ideas?
 
Thanks alot. I can't believe I did not see that. Could you please explain
the value member and databindings?

Thanks

Greg said:
this.sizecombobox.DataSource = ds.Tables["tblModelProbe"];
this.modelComboBox.DisplayMember = "strProbeSizeID";


these are 2 different comboboxes

Darin said:
Thanks for your response. I do that in the following code:

this.sizecombobox.DataSource = ds.Tables["tblModelProbe"];
this.modelComboBox.DisplayMember = "strProbeSizeID";

I have other combo boxes working however this is the first one with a stored
procedure with a parameter. When debugging I can see the dataSet has the
correct data. Any other ideas?

Thanks again

Greg said:
You need to set your Display Member on the ComboBox control.

myComboBox.DisplayMember = "myDataSet.MyDataTable.Column whoms text
needs
to
be displayed"

Hi,

In my app I am trying to bind a dataset to a combo box and I am having
some
trouble. In the combo box it shows this "System.Data.DataRowView" for
each
record. It is showing the correct number of records. I am calling a
stored
procedure in Access with a parameter. It seems to run fine. Any ideas?
 
Far too much to cover in this forum. I would take a look at the sdk
and\or msdn for these.
 
Back
Top