W
web1110
Hi y'all,
I tried to bind a one column table to a ComboBox and got this error:
"Complex DataBinding accepts as a data source either an ILIST or an
ILISTSOURCE"
The code is:
DataSet dataSet1;
DataTable dataTable1 = new DataTable("LastNames");
dataTable1.Columns.Add(new DataColumn("LastNames", typeof(string)));
dataTable1.Rows.Add(new object[] {"Smith"});
dataTable1.Rows.Add(new object[] {"Jones"});
dataTable1.Rows.Add(new object[] {"Wesson"});
dataSet1.Tables.Add(dataTable1);
try
{
comboBox1.DataSource=dataSet1.Tables["LastNames"].Columns["LastNames"];
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
But this works on a DataGrid:
dataGrid1.SetDataBinding(dataSet1, "LastNames");
Apparently I need to get an ILIST or an ILISTSOURCE for the table. Can
someone give me a pointer here?
Thanx,
Bill
I tried to bind a one column table to a ComboBox and got this error:
"Complex DataBinding accepts as a data source either an ILIST or an
ILISTSOURCE"
The code is:
DataSet dataSet1;
DataTable dataTable1 = new DataTable("LastNames");
dataTable1.Columns.Add(new DataColumn("LastNames", typeof(string)));
dataTable1.Rows.Add(new object[] {"Smith"});
dataTable1.Rows.Add(new object[] {"Jones"});
dataTable1.Rows.Add(new object[] {"Wesson"});
dataSet1.Tables.Add(dataTable1);
try
{
comboBox1.DataSource=dataSet1.Tables["LastNames"].Columns["LastNames"];
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
But this works on a DataGrid:
dataGrid1.SetDataBinding(dataSet1, "LastNames");
Apparently I need to get an ILIST or an ILISTSOURCE for the table. Can
someone give me a pointer here?
Thanx,
Bill