KADI SARVA VISHWAVIDYALAYA
LDRP INSTITUTE OF TECHNOLOGY AND RESEARCH
GANDHINAGAR
Department of
Computer Engineering and Information Technology
Subject: Dot Net Technology (CT506-N)
Laboratory Manual
Prepared By
Shashank J Muchhadiya
19BECE30564
5CE-Shift-2, b*
19BECE30564
Practical 1
Aim: Write a program on arithmetic calculator using Windows Application.
Steps to Perform:
• Open Visual Studio.
• Create a new Project, select a particular language (Visual Basic) in which you want to write a
code.
• Then select Form Type (Windows Application).
• Give proper name to the file and save in particular directory in which you want to save that file.
• After creating and saving the file, we get a form name “Form1”.
• Change the name and text property of the “Form1”.
• Now, from the Toolbox click on the button and textbox and drag it to the current form.
• After this we have all the buttons for performing operations and a single textbox for displaying
the results.
• Then now, change the name and text property of all the buttons and the textbox.
• Now the time to code, click on the particular button and write a code for that button (Button
Click Event).
• After completing the code for all the buttons build the solution and press either Start button or
F5 to run the program.
Program:
Public Class Form1
Private Sub btn0_Click(sender As Object, e As EventArgs)
Handles btn0.Click txtDisplay.Text = txtDisplay.Text +
"0"
End Sub
Private Sub btn1_Click(sender As Object, e As EventArgs)
Handles btn1.Click txtDisplay.Text = txtDisplay.Text +
"1"
End Sub
Private Sub btn2_Click(sender As Object, e As EventArgs)
Handles btn2.Click txtDisplay.Text = txtDisplay.Text +
"2"
End Sub
19BECE30564
Private Sub btn3_Click(sender As Object, e As EventArgs)
Handles btn3.Click txtDisplay.Text = txtDisplay.Text +
"3"
End Sub
Private Sub btn4_Click(sender As Object, e As EventArgs)
Handles btn4.Click txtDisplay.Text = txtDisplay.Text +
"4"
End Sub
Private Sub btn5_Click(sender As Object, e As EventArgs)
Handles btn5.Click txtDisplay.Text = txtDisplay.Text +
"5"
End Sub
Private Sub btn6_Click(sender As Object, e As EventArgs)
Handles btn6.Click txtDisplay.Text = txtDisplay.Text +
"6"
End Sub
Private Sub btn7_Click(sender As Object, e As EventArgs)
Handles btn7.Click txtDisplay.Text = txtDisplay.Text +
"7"
End Sub
Private Sub btn8_Click(sender As Object, e As EventArgs)
Handles btn8.Click txtDisplay.Text = txtDisplay.Text +
"8"
End Sub
Private Sub btn9_Click(sender As Object, e As EventArgs)
Handles btn9.Click txtDisplay.Text = txtDisplay.Text +
"9"
End Sub
Private Sub btndot_Click(sender As Object, e As
EventArgs) Handles btndot.Click txtDisplay.Text =
txtDisplay.Text + "."
End Sub
Private Sub btnAddition_Click(sender As Object, e As
EventArgs) Handles btnAddition.Click txtDisplay.Text =
txtDisplay.Text + " + "
End Sub
Private Sub btnMinus_Click(sender As Object, e As
EventArgs) Handles btnMinus.Click txtDisplay.Text =
txtDisplay.Text + " - "
End Sub
22BECE30338
19BECE30564
Private Sub btnMultiplication_Click(sender As Object, e As
EventArgs) Handles btnMultiplication.Click txtDisplay.Text =
txtDisplay.Text + " * "
End Sub
Private Sub btnDivision_Click(sender As Object, e As
EventArgs) Handles btnDivision.Click txtDisplay.Text =
txtDisplay.Text + " / "
End Sub
Private Sub btnClear_Click(sender As Object, e As
EventArgs) Handles btnClear.Click txtDisplay.Clear()
End Sub
Private Sub btnEqual_Click(sender As Object, e As
EventArgs) Handles btnEqual.Click
Dim sol As String Dim answer As Double sol =
txtDisplay.Text answer = New
DataTable().Compute(sol, Nothing)
txtDisplay.Text = answer
End Sub
End Class
22BECE30338
19BECE30564
Output:
22BECE30338
19BECE30564