This document contains the source code for a basic calculator program with buttons for numbers 0-9, addition, subtraction, square root, clear, and exit functions. When the number buttons are clicked it appends the number to the temporary text box. The operator buttons store values in labels and clear the temporary text box. The equal button performs the math operation on the stored values and displays the result.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
28 views
Machine Problem 1
This document contains the source code for a basic calculator program with buttons for numbers 0-9, addition, subtraction, square root, clear, and exit functions. When the number buttons are clicked it appends the number to the temporary text box. The operator buttons store values in labels and clear the temporary text box. The equal button performs the math operation on the stored values and displays the result.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3
MACHINE PROBLEM #1
Screenshot
Source Code Public Class Form1 Private Sub Button14_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click End End Sub
Private Sub Button10_Click(sender As System.Object, e As System.EventArgs) Handles
Button10.Click txtTemporary.AppendText("0") End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click txtTemporary.AppendText("1") End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles
Button2.Click txtTemporary.AppendText("2") End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles
Button3.Click txtTemporary.AppendText("3") End Sub
Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles
Button4.Click txtTemporary.AppendText("4") End Sub
Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles
Button5.Click txtTemporary.AppendText("5") End Sub
Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles
Button6.Click txtTemporary.AppendText("6") End Sub
Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles
Button7.Click txtTemporary.AppendText("7") End Sub
Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles
Button9.Click txtTemporary.AppendText("8") End Sub
Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles
Button8.Click txtTemporary.AppendText("9") End Sub
Private Sub Button12_Click(sender As System.Object, e As System.EventArgs) Handles
btnCancel.Click txtResult.Text = "" txtTemporary.Text = "" Label1.Text = "" Label2.Text = "" Label3.Text = "" End Sub Private Sub Button13_Click(sender As System.Object, e As System.EventArgs) Handles btnAdd.Click Label1.Text = txtTemporary.Text Label2.Text = "+" txtTemporary.Clear() End Sub
Private Sub Button16_Click(sender As System.Object, e As System.EventArgs) Handles
btnEqual.Click Label3.Text = txtTemporary.Text Dim n1 As Double n1 = Convert.ToDouble(Label1.Text) Dim n2 As Double n2 = Convert.ToDouble(Label3.Text) Dim n3 As Double n3 = n1 + n2 txtResult.Text = Convert.ToString(n3) End Sub Private Sub Button15_Click(sender As System.Object, e As System.EventArgs) Handles btnSqr.Click Dim Sqrt As Double Sqrt = Convert.ToDouble(txtTemporary.Text) txtResult.Text = Convert.ToString(Math.Sqrt(Sqrt)) End Sub
Private Sub Button11_Click(sender As System.Object, e As System.EventArgs) Handles
btnDot.Click txtTemporary.AppendText(".") End Sub End Class