Let's Start Now : National University of Computer and Emerging Sciences
Let's Start Now : National University of Computer and Emerging Sciences
Dear All!
My self Khizar Sultan and its really honor for me to be a Assistant of Ma’am Aliza
Saeed. In this manual, I will try my best to teach you the GUI phase with C#(Desktop
Applications) and with Php(Responsive Web Applications)
Before starting this manual, please make sure you have installed the following
softwares:
1. Visual Studio (version >= 13)
https://visualstudio.microsoft.com/downloads/
2. SQL Server
https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-
management-studio-ssms?view=sql-server-2017
3. Wamp Server
https://drive.google.com/open?id=1R4FZDB1AAzhVWbxqbTyudVXBiTtXLlcj
4. Wamp_server Connection File
https://drive.google.com/open?id=1aj_CiA3ylvwSbZXsnB8CZjJ8lvQ8Pp-N
5. MySql_Connector(for wamp server connection)
https://drive.google.com/open?id=1p8YgSkotOMMV-y8_7OJCG4vt8EjtHh6o
6. Sublime text (for web application)
https://www.sublimetext.com/3
C# GUI Phase
(1) Open Visual Studio
• Press control+shift+n
• Select Visual C# (Window Form Applications)
• Click Ok.
(3) Drag four buttons from toolbox and change their text as Insert, View, Update
and Delete as given follow.
(4) Now Click on the Project name and Select Add and Click “UserControl”
National University of Computer and Emerging Sciences
(6) Add three more UserControls and Name them View.cs, Delete.cs and
Update.cs
National University of Computer and Emerging Sciences
(7) Now Re-Build your Project in Build option and Make Sure these usercontrols
are Appearing in Toolbox like this:
National University of Computer and Emerging Sciences
(8) Now Double Click on the “insert.cs” from the solution Explorer and Design this
as given follow.
• Labels, TextBox and Button
National University of Computer and Emerging Sciences
(10) Now Rebuild Project and drag the insert (user control) from the
toolbox like as follow:
National University of Computer and Emerging Sciences
(14) Click on the Data source in Visual Studio and click Add new Source
(15) copy server name from Sql server and Paste it at New Connection.
National University of Computer and Emerging Sciences
National University of Computer and Emerging Sciences
(17) Now double click on the Insert Button and View button and write the
following code there
class Sql_Db_Connection
{
public SqlConnection connection;
public SqlCommand command;
public SqlDataAdapter sqlDataAdapter;
return bindingSource;
}
}
(19) Double Click the “insert” button on the Insert.cs and do code there like
as follow:
string query = "INSERT INTO Crud_Table VALUES('" + Id + "','" + Fname + "','" + Lname + "','" + semester + "','" + gpa + "','" +
contact + "') ";
if(connection.insert_query(query))
{
MessageBox.Show("Data Inserted Successfully");
}
(20) Double click “Refresh” Button in the View.cs and do code there like as
follow:
Assignment: 01
You have to complete Delete and Update Operations
(3) Click in the References in the Visual Studio and Click Add New Reference
and search “mysql” make all the reference and click OK
this.txtfname.Text = r["FirstName"].ToString();
National University of Computer and Emerging Sciences
this.txtlname.Text = r["LastName"].ToString();
this.txtpassw.Text = r["Email"].ToString();
this.textpass.Text = r["Password"].ToString();
this.dataUser.Text = r["DOB"].ToString();
}
}