tutorial

Display Record in DataGridView Based on ComboBox Selected Value

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

[inline:ComboBox_Data_Binding.jpg=Bind a ComboBox]

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

How to Catch Duplicate Entry - Primary Key

This tutorial will guide you on how to determine if the primary key entered is already exist in the table. I created this tutorial in the hope to help newbie’s programmer solve this common problem. Instead of displaying the default message cast by Visual Basic a message “Employee ID already exist. Please enter another Employee ID.” will appear. For those who would like to see the source code