Combobox in DataGridView

Posted on 2009-02-16
Last Modified: 2012-05-06
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";




                SqlConnection c = new SqlConnection(ConnectionString);

                adap = new SqlDataAdapter(sql, c);

                SqlCommandBuilder cb = new SqlCommandBuilder(adap);

                if (c.State == ConnectionState.Closed)


                dt = new DataTable();


                dataGridView1.DataSource = dt;


            catch (Exception ex)


                MessageBox.Show("Please select Date " + ex.Message);




Open in new window

Question by:Mr_Bach
    LVL 29

    Expert Comment

    LVL 29

    Accepted Solution

    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...


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now