I want to make the first item of Combobox as blank and what I try is as below:
//Connection variables
SqlConnection conn;
SqlCommand com;
String message;
conn = new SqlConnection(connection);
message = "select Acc_Type_ID, Acc_Desc from tbl_Account_Type;";
//Opening connecion
conn.Open();
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
com = new SqlCommand(message, conn);
com.ExecuteNonQuery();
DA.SelectCommand = com;
DA.Fill(DS);
conn.Close();
if (DS.Tables[0].Rows.Count > 0)
{
AccType.DataSource = DS.Tables[0];
AccType.DisplayMember = "Acc_Desc";
AccType.ValueMember = "Acc_Type_ID";
}
else
{
MessageBox.Show("Error to fetch data from table");
}
But it does not show the first item as blank anyone to help in this regards.