Sie sind auf Seite 1von 23

Computer Science Department

Laboratory Practice one


Visual Studio
Microsoft Visual Studio is an integrated development environment (IDE) from
Microsoft. It can be used to develop console and graphical user interface
applications along with Windows Forms applications, web sites, web applications,
and web services in both native code together with managed code for all
platforms supported by Microsoft Windows, Windows Phone, Windows CE, .NET
Framework, .NET Compact Framework and Microsoft Silverlight.
.NET Framework
The .NET Framework (pronounced dot net) is a software framework that runs
primarily on Microsoft Windows. It includes a large library and supports several
programming languages which allow language interoperability (each language
can use code written in other languages).The .NET library is available to all the
programming languages that .NET supports. Programs written for the .NET
Framework execute in a software environment, known as the Common
Language Runtime (CLR), an application virtual machine that provides important
services such as security, memory management, and exception handling.
The class library and the CLR together constitute the .NET Framework.
There exist different versions of Visual Studio:
a) Visual Studio Express (free),
b) Visual Studio Professional,
c) Visual Studio Premium and
d) Visual Studio Ultimate.
Getting Started Visual Studio Professional

New Project
The first thing you do when you want to create a new application is to create a new project. This can be
done from the Start Page:
The most common applications that can be developed are:
a) Windows Form Applications
b) Console Applications
c) WCF Applications
d) ASP.NET Applications
e) SilverLight Applications
Solution Explorer

Toolbox
Properties window
Practical Lab
Design the following Student Registration form using based on the following ToolBoxes

a) Label for Student Registration Form (Set properties to RED)


b) Label for Basic Informations and Eduactions (Same colour)
c) Label for ID and TextBox for TextField
d) Label for FirstName and TextBox for TextField
e) Label for MiddleName and TextBox for TextField
f) Label for LastName and TextBox for TextField
g) Label for Age and TextBox for TextField
h) Label for Department and TextBox for TextField
i) Label for Pogram and RadioButton for Degree and Diploma
j) Label for Section and RadioButton for Regular and Extension
k) Label for Gender and ComboBox for TextField
l) Label for Group and ComboBox for TextField
m) Insert Backgroung Image or Change the Colour
n) Add three Buttons and Rename them as List Students(Blue),
Register(Green), and Exit(Red) respectively.
o) Add ToolTip for Each TextFields.

You must Finish all steps to get full grade.


Computer Science Department
Laboratory Practice Two
Standard Calculator Programming Practice
1) Open a visual studio New Project (Visual Basic) Windows - Windows Form Application
2) Rename solution name to Calculator
3) Design the standard Calculator similar to the following in design interface. Change to

Standard Calculator

Sta

Use TextBoox

Buttons

Width = 55
Height = 44
Font = Bold

4) Change Form Text to Standard Calculator


Make size of form 392 X 3012
Make maximizeBox and MinimizeBox False
Choose BackColor You want.

Go to ToolBox and Select TextBox, put it around Result Display area.

Instructor Ararsa Lemmessa 23-12-2017


Declare the following variables inside the general part of form.
Dim previous As Double
Dim current As Double
Dim tempValue As Double

Dim hasDecimal As Boolean


Dim status As Boolean
Dim clearText As Boolean
Dim calcFunc As String

5) Click one of numbers(1-9) s CommandButton, then insert the following code in the its event
procedure.
If status Then
TextBox1.Text &= Button1.Text
Else
TextBox1.Text = Button1.Text
status = True
End If

6) Do same procedure for all numbers(1-9 except 0 and dot (.))


7) Click zero CommandButton, then insert the following code in the its event procedure.

If status Then
If TextBox1.Text.Length >= 1 Then
TextBox1.Text = TextBox1.Text & Button0.Text
End If
End If

8) Click Dot CommandButton, then insert the following code in the its event procedure.

If status Then
If Not hasDecimal Then
If TextBox1.Text.Length >= 1 Then
If Not TextBox1.Text = "0" Then
TextBox1.Text = TextBox1.Text & Button15.Text
hasDecimal = True
End If
Else
TextBox1.Text = "0."
End If
End If
'TextBox1.Text = "0."
End If

Now, Operation is completed. The next is analyzing how to identify


which operator is done and display the result on TexBox.

Instructor Ararsa Lemmessa 23-12-2017


a) Click X operation and then write the following codes in its procedures.

If TextBox1.Text.Length <> 0 Then


If calcFunc = String.Empty Then
previous = CDbl(TextBox1.Text)
TextBox1.Text = String.Empty
Else
'call function here
Calculation()
End If
calcFunc = "mult"
hasDecimal = False
End If

b) Do the same procedure for +, -,and / operations.


c) Write the sub procedure called Calculation and insert the following codes.

current = CDbl(TextBox1.Text)
If current = 0 Then
MessageBox.Show("Division by Zero is Undefined.")
End If
Select Case calcFunc
Case "add"
previous = previous + current
Case "sub"
previous = previous - current
Case "mult"
previous = previous * current
Case "div"
previous = previous / current
End Select
TextBox1.Text = previous
status = False
d) Click = commandButton, then enter the following codes.
Calculation()
e) After You finish all the above codings, save and run the program
f) If there is error report during building and/or running, ask for help your instructor.
g) Leaving class before finish the lab is not allowed.
h) Completely Completed work has 5% mark values for the all group.

Instructor Ararsa Lemmessa 23-12-2017


Rift Valley University
RAD lab 2

Design University Management System closely looks the following screen shot.

Step 1:

a) Design Login Page as shown


b) Design Home page as shown
c) Add Menus as shown on home page
d) Add Registration page as shown
e) Design Login Page as shown
A) Login Page

Labels
TextBox
es
Button

Double Click Login button, then insert codes below into login button handler sub procedure.
B) Home Page
Go to Project Add Windows Form rename as home then design as
below screen shot.

MenuStrip

In File Add Whatever you want like Department, courses, Save, Exit etc.
C) Registration Page
Desing like this

Double click save button, insert these codes.Note that declare the variables.
Rift Valley University
RAD
Lab-6 CRUD Operations
Do the following procedures
Database Creation
1) Create Ms Access Database called sis.accdb
2) Create users(ID int, username String, password str, role int) table
3) Create StudentInfo(ID int, fullname String, gender str, birthdate str,
phone str, department str, year int, program str, photo str) table
4) Create departments(ID int, name String) table
5) Insert some default values for each tables
Interface Design
Design login, home and addStudent Pages as given. (Use lab-2 Interface
if you have saved it.)
Login form
Home form

Add Student Form


Connecting to Database

a) Click Data Source, then add New Data Source

Step 2. New Data Source

Step 1. Click Data Source

Go to the all steps till you connected created database, sis.accdb


======Your System is connected to Database !!!! ===========

Coding

a) Double click Login button of Login page, then insert this code.
Understand that the role of this code

Note: HomePage is Home form (Yours may different)


Button1 is login button.
b) Go to Add Student form and double click the Update button

Update button code


UpdateAndRegister() Procedure Code (Used to Show data on right Side)

Run and Check to Work.

Assignment
Complete with same procedures for:-
1) Save button
2) Delete Button
3) Search Button

Note: When Save button is clicked, inserted data on the add student
form must be save on the database.
When Delete button is clicked, data which is saved on database with
same id of the form must be deleted. If not exist, System must inform
there is no data.
For Search Button, if id numer is inserted in (Enter ID) place, then after
Search Label is clicked, data [If exist] must be displayed on the form
from database, else inform no data exists.

Sumit Date Next Lab session. (You must submit hardcopy and
Demostrate in the lab). One Group = 4/5 members only
Rift Valley University
Computer Science Department
RAD lab-7
Installing and Configuring IIS with ASP.NET Modules
The first step in building an ASP.NET website on IIS 8 is to install IIS along with the ASP.NET
modules. Then add your ASP.NET application files to IIS. When you are done, make sure that IIS
and the ASP.NET modules are installed, and your ASP.NET application has been added to your
website.

Important
To install IIS on either Windows 7 or Windows 8, you must sign on as a member of the
Administrators group. If you prefer, you could use the Web Platform Installer (Web PI) to install
IIS and third-party applications that run on IIS. Because the Web PI installs the latest versions of
available Web Platform offerings, with just a few simple clicks you can download and install any
new tools or updates. If you support web applications written using ASP.NET 2 to 3.5, install .NET
3.5 before installing IIS and ASP.NET modules.

To install IIS on Windows 7 or Windows 8


1. Start Control Panel Programs Turn windows features on or off
2. Then wait a minutes to load programs
3. Go to Internet Information services Select it Web Management tools Select it
4. Select the features drawn in blue as shown the screenshot.

Instr. Ararsa Lemmessa@2017


5. Click Ok. Wait for a minutes to completes the configurations.

Registering ASP.NET to IIS Web Server


1. Verify that you have installed .Net Framework
2. Look for asp_regiis.exe file
Go to the location you installed .NET framework. In my case, Installed at
C drive Windows Microsoft.Net Framework

3. Select and open .Net framework you want [I prefered v4.0.30319], then
look for asp_regiis.exe file.

Instr. Ararsa Lemmessa@2017


4. Go to Start Type Command Prompt Right Click Run as Administrator
cd .. [enter] 2 times cd Windows/Microsoft.NET/Framework/v4.0.30319

5. Write asp_regiis - i then wait to finish installing

6. Now, You have finished ASP.NET configurations.


7. The next is to enable restrictions. Go to Start Internet Information Service (IIS)
Manager In Feature View, User Home [home] ISAPI and CGI Restrictions [double
click] Change not allowed [Restriction tab] to Allowd.
8. Finished.

Testing to run ASP.net


a) Go to Start Microsoft Visual Studio 2012 Visual Studio 2012 Right Click [run as
adminstrator]
b) In Visual Studio, File New Web site Browse [Local IIS] Open Ok
c) Run the Project. You must see [If Web form is selected] the following

Instr. Ararsa Lemmessa@2017

Das könnte Ihnen auch gefallen