Hi,
I have an following issue.
Items collection cannot be modified when the DataSource property is set.
I am using Combobox in c#.net windows application.
at form load event following code.
setCombobox_LoadRecords("SELECT ProductName FROM Product_Info", "Product_Info", "ProductName", comboBoxPerticulars);
that calls method below.
public static void setCombobox_LoadRecords(string SQL, string Table, string FieldName, ComboBox combo)
{
try
{
combo.Items.Clear();
DataSet dataset = new DataSet();
Adapter = new SqlDataAdapter();
connection.setCommand(dataset, Adapter, SQL, Table);
combo.DataSource = dataset.Tables[0].DefaultView;
combo.DisplayMember = FieldName;
combo.ValueMember = FieldName;
combo.SelectedIndex = -1;
}
catch (Exception ex) { ex.ToString(); }
}
so i want to show Select Text at index -1.
Please help me.