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?
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);
            }
    
        }

Open in new window

Mr_BachAsked:
Who is Participating?
 
anarki_jimbelCommented:
Honestly, what I don't like is  when experts give some info and ask a questions to help the asker and never get reply. Then after a while  - the question is closed because of "No answer". And there is a feeling that this info might be used but nobody wanted to allocate points. Might be not - but who knows, no feedback what so eve (BTW, I'm not claiming any points - just my thoughts). A bit of respect would be good...

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.