Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

This Program Automatically Loads Database Table To A Listbox Control and The Selected Value in Listbox Will Appear in Datagridview

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

POST #1:

This program automatically loads database


table to a listbox control and the selected
value in listbox will appear in
DataGridView.
Prepared by:
Ronald D. Ayson
BSIT 3B1

Step 1. Open the Visual Studio 2010 or C# Application

Step 2. click new Project on the left side

Click

Step 3. Select Windows Forms Application

You can edit the name of the form

Click ok to move

This is the form that you can design your work


Toolbox

Solution Explorer

You can choose an item


for you work and design

Properties
You can edit the name,font,
color etc here

Step 4.Create a form like this, find it at the tool box

dataGridView
listBox

You can edit the name of the listbox and


datagridview by selecting listbox or
Datagridview and select properties

Step 5.Select the name of your project here, then select Add after that click Class.
Right click then click
add and class

Step 6: Select Class and name the class as DBConnect.cs after that click Add button
below.

Click

Edit the name as DBConnect.cs

Click

Step 7:

Type the codes

To connect the C# in your


database workbench

Step 8. Repeat adding a class


Right click then click
add and class

Step 9:Select Class and name the class as ClassStudents.cs after that click Add button below.

Click

Edit the name as ClassStudents.cs

Click

Step 10:

Type the codes

Same input from the


database workbench

Step 11: Go to solution Explorer then right click REFERENCES and 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

Click

And MySql.Data.Entity.dll

Click

Step 12. Go to Desktop and Open the MySQL Workbench application if you dont have then try to
install the installer inside the folder of 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 and follow theInstruction below.

Click this first

Then second
click this

Then Click and attach the


psu.sql here

Click start
import

Step 13. Go back to your C# application, double click


the FORM 1 in design.
Double click

Step 14: Type the codes

Step 15. Run the program


Automatic load the data

Reference

of the program:

Thank you

You might also like