C# dataset and Combo Box problems

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

Would someone tell me how to fill a dataset into a Combo Box?
I need the ComboBox by default to show the first DataRow from the dataTable.
Thanks for help.


Jason
 
Jason,

\\\
combo.DataSource = dt;
\\or Combobox.DataSource = ds.tables["TheTableName"];
combo.DisplayMember = "theDisplayColumn";
combo.ValueMember = "theValueColumn";
combo.SelectedIndex = 0;
///

If you have problems than it is probably that you set the handler to early
(using the designer). You should add the handler after this.

I hope this helps,

Cor
 
Back
Top