ConaWendyPostNo.1

15
The program will automatically loads database table into a listbox control and the selected value in the listbox will appear in DataGridView. POST No.1: Cona, Wendy BSIT3_b1

description

The program will automatically loads database table into a listbox control and the selected value in the listbox will appear in DataGridView.

Transcript of ConaWendyPostNo.1

The program will automatically loads database table into a listbox control and

the selected value in the listbox will appear in DataGridView.

POST No.1:

Cona, Wendy

BSIT3_b1

Step 1. Open Visual Studio 2012 Step 2. click new Project

Step 3. Select Visual C# then Windows Forms Application

Then click OK button.

You can edit the name of

project

Datagridview1

Step 4.Create a form like this, drag the selected listBox to the form, and also The Datagridview from the ToolBox

ListBox1

You can edit the name of lisbox and datagridview

by selecting Listbox or Datagridview in properties.

Step 5.Select the name of project here, then right click select Add then click Class.

Select Visual C# Items then select Class and

Name the class as “DBConnect.cs” after that click Add button below don’t forget the extension .cs and the click Add button.

Step 6. this step is almost the to step 5 except the name of the class,

Select the name of your project here, then select Add after that click Class.Select Visual C# Items then select Class and

Name the class as “ClassStudents.cs” after that click Add button below.

Step 7. Select Reference in solution Explorer and then select Add reference

Click browse then go to

C:\Program Files (x86)\MySQL\Connector NET 6.7.4\Assemblies\v4.5

If v4.5 didn't work choose v2.0 or v4.0 version

After that select the MySql.Data.dll

And MySql.Data.Entity.dll

Step 8. Go to Desktop, Open the MySQL Workbench

Use the password: admin if necessary.

Then click “Data Import/Restore” you can browse it just click the button.

Select this

1.

2. 3.

Click this button

4.

Step 9. Here’s the coding portion, go back to the Visual Studio 2012 Application and go to DBConnect.cs and insert this code.

Insert this code

Start coding here

Coding continue

Step 9. Go to your form1.cs double click form and code this.

Insert this

Start coding here

Code continue

Step 10. F5 to run the program. Output will be like this.

ThankYouHope you like it.

References/installer: