DataSet Question

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi,

I have a DataSet that I am using to bind to a combobox. I am trying to get
the column name so I can use it for the display member. I am using the code
below to get it, is there a better way?

DataTable tbl = ds.Tables[0];
DataColumn col = tbl.Columns[0];
this.sizeComboBox.DisplayMember = col.ColumnName;
 
You can use DataSetName.Tables[TableIndex].ColumnName which would save you a
line....
 
Thanks for the post. The code you posted did not work here is the code that
will:

DataSetName.Tables[TableIndex].Columns[ColIndex].ColumnName

William Ryan said:
You can use DataSetName.Tables[TableIndex].ColumnName which would save you a
line....
John said:
Hi,

I have a DataSet that I am using to bind to a combobox. I am trying to get
the column name so I can use it for the display member. I am using the code
below to get it, is there a better way?

DataTable tbl = ds.Tables[0];
DataColumn col = tbl.Columns[0];
this.sizeComboBox.DisplayMember = col.ColumnName;
 
Back
Top