0% found this document useful (0 votes)
32 views

Post 1

This document provides a 10 step guide to automatically loading database table data into a listbox and displaying the selected value in a datagridview. It includes steps to set up the project, add controls to the form, connect to a MySQL database, import sample data, and code the logic. The code connects to the database, loads students table data to the listbox, and displays the selected student details in the datagridview upon selection.

Uploaded by

Mowski Kowski
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Post 1

This document provides a 10 step guide to automatically loading database table data into a listbox and displaying the selected value in a datagridview. It includes steps to set up the project, add controls to the form, connect to a MySQL database, import sample data, and code the logic. The code connects to the database, loads students table data to the listbox, and displays the selected student details in the datagridview upon selection.

Uploaded by

Mowski Kowski
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

POST #1:

THIS PROGRAM AUTOMATICALLY LOADS


DATABASE TABLE TO A LISTBOX CONTROL AND
THE SELECTED VALUE IN LISTBOX WILL APPEAR
IN DATAGRIDVIEW.

Presented By:
Rodolfo I. Marzo III
IT3-B1

STEP 1. OPEN THE VISUAL STUDIO 2012 OR C# APPLICATION

STEP 2. CLICK NEW PROJECT

STEP 3. SELECT VISUAL C# AND THEN SELECT WINDOWS


FORMS APPLICATION AFTER THAT CLICK OK

Edit the
name
Of your
project
here

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

DATA GRID
VIEW

You can edit the name of the list box and data gridview
by selecting List box or Data gridview and select properties

STEP 5.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 DBConnect.cs after
that click Add button below.

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 AND OPEN THE MYSQL WORKBENCH


APPLICATION IF YOU DONT HAVE THEN TRY TO INSTALL THE
INSTALLER INSIDE THE FOLDER OF AUTOMATIC LOAD DATABASE
THEN USE PASSWORD: ADMIN WHEN THE INSTALLATION IS NEAR
TO COMPLETE, AFTER THAT OPEN THE MYSQL WORKBENCH
APPLICATION THEN CLICK OR OPEN THE LOCAL INSTANCE THEN
TYPE THE PASSWORD: ADMIN AFTER THAT, GO TO MANAGEMENT
THEN SELECT DATA IMPORT/RESTORE THE FOLLOW THE
INSTRUCTION BELOW.

Select
this

Click this

THEN GO TO THE FOLDER YOU DOWNLOAD INCLUDING THIS


POWER POINT AND SELECT THE STUDENT_STUDENTS.SQL
FILE THEN OK AND CLICK BUTTON START IMPORT

Click this

STEP 9. HERES 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

Continue coding
here

Continue coding
here

Step 9. Go to your form1 or design double click


the form and insert this code.

Insert this

Start coding
here

Continue coding
here

Step 10. F5 to run the program and the output is


look like this.

REFERENCE OF
THE PROGRAM:

Thank you
I hope
You learn a lot

You might also like