Share Your Source Code or Article

Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog.

Submit now...

Database Programming Made Easy

This tutorial will teach you step by step on how to connect and manipulate database. If you'd like to suggest a tutorial please write a comment at the bottom of this article.

Read more...

Hire Us to Do Your Work

Do you want a customized system? Do you want to setup your own website to do business? Then we are here to help you in your programming needs.

Read more...

Search

How to Configure ComboBox in DataGridView
admin's picture


0
Your rating: None
Language: 

I feel it would be necessary to create a tutorial on how I program the ComboBox in DataGridView. So, this tutorial will guide you on how to:

  1. Add DataSet
  2. Create a master/detail form
  3. Add ComboBox in DataGridView

How to add a DataSet

1. Click on the Data Sources.

2. Click Add New Data Source.

Follow the data source configuration wizard. Be careful though on naming your DataSet. In my case if I add two tables like Orders and Order Details I named my DataSet as OrdersDataSet.

3. Edit the newly created DataSet and add a relationship as shown below:

Add Relationship

Orders and Order Details Relationship

Click on the OrderID field in the Orders table and change the AutoIncrement Property to True. Set the AutoIncrementSeed and AutoIncrementStep value to 1.

AutoIncrement OrderID</p>
</p></blockquote></blockquote>
<h2>How to add a Master/Detail form</h2>
<p>One of the most awaited features I like in MS Access is the ability to add a master/detail form easily using a wizard. In Visual Basic .NET this can be done easily also by using the drag and drop operation. After you add a DataSet with Orders and Order Details table follow the following steps to add a master/detail form.</p>
<blockquote>
<p>1. Drag the Orders Table from the Data Sources window to Windows Form.</p>
<blockquote>
<p>In the Data Sources window change how you would like to view your form in Windows Form. In this case the Orders table should be displayed in Details view. Don’t be confused about the term master/detail form. This simply means that we will display the Orders Table using TextBoxes and not in DataGridView control.
    </p>
<p>[inline:Orders_Details_View.jpg=Orders Details View

2. Drag the Order Details Table under the Orders Table.

Order Details

How to add ComboBox in DataGridView

1. Right click DataGridView control and click Edit Columns.
2. Delete other fields and leave only Qty, ProductID, and SalesPrice.
3. Click ProductID in the selected columns section and change the column type to DataGridViewComboBoxColumn.

Product ColumnType

4. Edit the Data properties of ProductID

Product Column Data Properties

I hope this help.




hi

how to add datas from a table to combox ?
thanks

hi

hi while adding relationship in this i get a error that says parent key and child key are identical

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <java>, <java5>, <javascript>, <mysql>, <php>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • Links to specified hosts will have a rel="nofollow" added to them.

  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

Step by Step Java Tutorial

In this tutorial you will learn how to program with Java. It has a rich of information to be educated well with Java.

Read more...

Do You Have Question?

Do you have any question related to computer programming? Visit our forum and post new topic on the category you like. Be gentle when asking a question.

Ask now...

Point of Sale

Point of Sale is very useful especially for supermarkets or restaurants. I have included a barcode scanner in this program. Please check it out.

Read more...