Well,that's a common error. When you fill the combobox, set the DisplayMember and ValueMember before binding the data. Like this:
comboBox1.DisplayMember = "TABLE_NAME";
comboBox1.ValueMember = "TABLE_NAME";
comboBox1.DataSource = dt;
The problem you have is because when you bind the data with comboBox1.DataSource = dt, the comboBox1.SelectedIndexChanged is fired. But as the valueMember is still not set, what is passed to the event is a DataRowView,causing the error.
Edit
If you want to prevent to load the grid when you bind the data to the combo,do something like this:
bool firstLoad=true;
.
.
.
private void cbTbl_SelectedIndexChanged(object sender, EventArgs e)
{
if (!firstLoad)
{
if (cbTbl.SelectedValue != null)
{
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
SqlConnection con = new SqlConnection(CS);
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = con;
sqlCmd.CommandType = CommandType.Text;
sqlCmd.CommandText = ("SELECT * FROM " + cbTbl.SelectedValue);
SqlDataAdapter sqlDataAdap = new SqlDataAdapter(sqlCmd);
try
{
con.Open();
dt = new DataTable();
sqlDataAdap.Fill(dt);
dataGridView1.AutoGenerateColumns = true;
dataGridView1.DataSource = dt;
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
else
{
firstLoad=false;
}
}
That is,use a boolean variable to prevent loading the datagrid view when the combobox data is binded.