Mr_Bach
asked on
Combobox in DataGridView
Hi, below is my code, I have column: Condition in table of SQL server, I want when I press button1, the column Condition will be showed like combobox with Items list created in C#.
How Can I do?
How Can I do?
private void button1_Click(object sender, EventArgs e)
{
String sql = "select * from Main";
try
{
SqlConnection c = new SqlConnection(ConnectionString);
adap = new SqlDataAdapter(sql, c);
SqlCommandBuilder cb = new SqlCommandBuilder(adap);
if (c.State == ConnectionState.Closed)
c.Open();
dt = new DataTable();
adap.Fill(dt);
dataGridView1.DataSource = dt;
}
catch (Exception ex)
{
MessageBox.Show("Please select Date " + ex.Message);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic17416.aspx
More tricky scenario:
http://www.c-sharpcorner.com/UploadFile/yougerthen/102122008053259AM/1.aspx
Is that what you want?