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

Display Record in DataGridView Based on ComboBox Selected Value
admin's picture


0
Your rating: None
Language: 

In this tutorial I will teach you on how to display related record based on the selection value from a ComboBox.

The example displays a student’s subject in a DataGridView after a SelectedIndexChanged event of a ComboBox.

This tutorial assumes that you already know how to add a DataSet in your project.

The following are important steps in order to understand how I made this simple program.

1. Bind a ComboBox

Bind a ComboBox

2. Add a query in the Course Table under DataSet designer

Add a query in the Course Table under DataSet designer

3. Edit DataGridView columns after binding from Data Source

Edit DataGridView columns after binding from Data Source

4. Select only the following field by removing unnecessary columns

 remove unnecessary columns

5. In the SelectedIndexChanged event of the ComboBox use the FillBy method instead of Fill method

FillBy method

As you can see in the DataSet designer there are two fill method in a Course table name Fill and FillBy. FillBy has a parameter named StudentID. This will tell our TableAdapter to filter the record using the FillBy method.


Download Code



kimy's picture

How to make design

Hi admin am beginner, and gusto ko sana pano gumawa ng design
for online reservation.
salamat po ng marami.
God bless you.

kimy

vb .net

how to add the data grid values to a ms access table in vb.net

sir jay

pls help us make a comuterized cashier system

vb and oracle

Hello SIr,

I want to develop a school management system using vb at front end and oracle as back end.Can u tell me some initial steps so that i could handle oracle without any problem?

Note:I dont know very much about using oracle.Can I develop it by only using sql server 2000/2005?

Sir Jay

I often find the member of this forum asking the programmer to convert their program to VB6 from the higher version. I think it is better if those who ask upgrade their software to higher version. You can get the Visual Studio 2008 by downloading from torrent or just buy it in the shop. I'm sure the price is not expensive because mostly they are pirated.

admin's picture

re: Sir Jay

Yes that's true. But some people is asking to downgrade the source code is due to the fact that their professor is still using VB 6.0 in their class. One reason is their computer may be cannot meet the specs of VB.NET.

For now I prefer to work with VB.NET as it has a lot of changes that makes coding easier and faster.

re: Sir Jay

I think if is so, then they may give a try to REALbasic. I just this this software. It's good and almost similar to VB, yet more powerful. This software is cross-platform. The coding is simple and you can convert the VB code to this software too. Just try it.

Get value from database based on combox

sir can you plz help me in combox view how to show value in datagrid view my email id is (link_atif@yahoo.com)

Display Record in DataGridView Based on ComboBox Selected Value

It is good to have this tutorial. But can you help me, how to display none in the combobox when it is loading, so that if the data is bigger the application can start quickly?

admin's picture

One of the approach if you

One of the approach if you have a lot of record to bind in a ComboBox is to filter the record based on the character that you have type in a combobox. This can be done in the Change event of a combobox.

One of the approach if you

Oh thanks for the suggestion. Can you give example? Just say I have four categories/items building, car, animal and electronic.
I have not tried yet, but in my point of view, if the future we want to add some more categories/item, to the database, I think we would find difficulty. Don't you think so?

jhervy14's picture

Sir Jay

Sir Jay

How to convert .net to vb6?

admin's picture

re: Sir Jay

I don't have much time converting this to vb 6 for now.

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