Insert a default row into a combobox that is bound to a datatable?

Posted by John M on Stack Overflow See other posts from Stack Overflow or by John M
Published on 2010-06-11T14:30:58Z Indexed on 2010/06/11 15:02 UTC
Read the original article Hit count: 172

Filed under:
|
|
|
|

On a winform there is a combobox that derives its information from a datatable. The datatable draws from a database list.

this.cboList.DataSource = pullData();
this.cboList.DisplayMember = "fieldA";

Once the DataSource is set I am not able to insert a default row (ie *) as the first item in the combobox.

I tried this:

this.cboList.Items.Insert(0,"*");

Is there a way to insert in the combobox after the datasource is set or should this be done in the datatable?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms