cannot create a child list for field
Posted on 2006-07-21
I have 3 combo boxes that I want to bind to data sources. First one works fine, but the other two have troubles.
The second one’s data only has one column. If I tried to assign the DisplayMember and ValueMember, run-time error says cannot bind to new value member. I commented out the ValueMember part, and the data shows up. However, without the ValueMember, I have hard time to retrieve the selected item/text/value.
The third one causes “Cannot create a child list for field xxx” error. The box shows system.data.dataRowView. No matter how I load my dataset (same ds but different table, or its own ds), the error is the same.
Here is one variation of my code:
Dim dsOptions As DataSet
dsOptions = SqlHelper.ExecuteDataset(cn_str_QWright_Dev, CommandType.StoredProcedure, "CT_getCSR")
dsOptions.Tables(0).TableName = "CSR"
cboCSR.DataSource = dsOptions.Tables("CSR")
cboCSR.DisplayMember = "CSR"
cboCSR.ValueMember = "EmployeeID"
dsOptions.Tables.Add(SqlHelper.ExecuteDataset(cn_str_QWright_Dev, CommandType.StoredProcedure, "CT_getRegions").Tables(0).Copy)
dsOptions.Tables(1).TableName = "Region"
cboRegion.DataSource = dsOptions.Tables("Region")
cboRegion.DisplayMember = "Regions"
'cboRegion.ValueMember = "regions" 'this one cause error it is the same fld
Dim dsOptions2 As DataSet
dsOptions2 = SqlHelper.ExecuteDataset(cn_str_QWright_Dev, CommandType.StoredProcedure, "CT_getCLGTypes")
dsOptions2.Tables(0).TableName = "CLGType"
cboType.DataSource = dsOptions2.Tables("CLGType")
cboType.DisplayMember = "CLGType.TypeName"
cboType.ValueMember = "CLGType.TypeID" 'err: cannot create a child list for field CLGType