Learn how to a build a cloud-first strategyRegister Now


Combobox in DataGridView

Posted on 2009-02-16
Medium Priority
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
  • 2
LVL 30

Expert Comment

ID: 23653421
LVL 30

Accepted Solution

anarki_jimbel earned 375 total points
ID: 24132787
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

810 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