Attaching Combobox to a Column in ADO .NET (with MS Access)

  • Thread starter Thread starter William
  • Start date Start date
W

William

I am trying to attach a combobox to a column in a table as follows:

daFiscalYear.Fill( dsFiscalYear );
cboFiscalYear.DataSource = dsFiscalYear.Tables["FiscalYear"];
cboFiscalYear.DisplayMember = "FiscalYearID";

da = data adapter
ds = dataset
cbo = combo box

The combobox was filled with the string: System.Data.DataRowView, for all
11 entries in the "FiscalYearID" column.

The strange part:
daResourceGroup.Fill( dsProjects );
cboSelectGroup.DataSource = dsProjects.Tables["ResourceGroup"];
cboSelectGroup.DisplayMember = "GroupName";

worked fine for displaying the column "GroupName" in table "ResourceGroup"
for the combo box cboSelectGroup.

Any suggestions as to why I am getting System.Data.DataRowView for the
combo box cboFiscalYear?
 
That's usually due to an incorrectly typed columname - Make sure it's
spelled exactly the same as the DataColumn.Name (including case). Let me
know fi tht doesn't fix it.

Cheers,

Bill

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
I have double checked the spelling, the column name was spelled correctly;
yet the same error persisted.


That's usually due to an incorrectly typed columname - Make sure it's
spelled exactly the same as the DataColumn.Name (including case). Let me
know fi tht doesn't fix it.

Cheers,

Bill

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
William said:
I am trying to attach a combobox to a column in a table as follows:

daFiscalYear.Fill( dsFiscalYear );
cboFiscalYear.DataSource = dsFiscalYear.Tables["FiscalYear"];
cboFiscalYear.DisplayMember = "FiscalYearID";

da = data adapter
ds = dataset
cbo = combo box

The combobox was filled with the string: System.Data.DataRowView, for all
11 entries in the "FiscalYearID" column.

The strange part:
daResourceGroup.Fill( dsProjects );
cboSelectGroup.DataSource = dsProjects.Tables["ResourceGroup"];
cboSelectGroup.DisplayMember = "GroupName";

worked fine for displaying the column "GroupName" in table "ResourceGroup"
for the combo box cboSelectGroup.

Any suggestions as to why I am getting System.Data.DataRowView for the
combo box cboFiscalYear?
 
Wouldn't the first DataTable in the DataSet "dsFiscalYear" be called
"Table"?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
www.sqlreportingservices.net
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top