-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dream Calculator 2.vb
64 lines (56 loc) · 2.12 KB
/
Dream Calculator 2.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Public Class frmDream_Calculator_2
REM Dream Calculator
' Inputs two numbers in text boxes
' Calculate +, -, x, /, ^2Root
' Displays the results
' (Input - Processing - Output)
' Multiple forms
' Transfers data inbetween froms
REM Started: 14/2/2014
REM Declare Form Level Variables
Dim XValue, YValue, AddResult, SubResult, MultResult, DivResult, SquareX, SquareRootX, CubedX As Single
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
REM Input
XValue = txtXvalue.Text
YValue = txtYValue.Text
REM Processing
AddResult = XValue + YValue
SubResult = XValue + YValue
MultResult = XValue * YValue
DivResult = XValue / YValue
SquareX = XValue ^ 2
SquareRootX = Math.Sqrt(XValue)
CubedX = XValue ^ 3
REM Output
lblAddResult.Text = AddResult
lblSubResult.Text = SubResult
lblMultiResult.Text = MultResult
lblDivResult.Text = DivResult
lblSquareResult.Text = SquareX
lblSquareRootResult.Text = SquareRootX
lblCubedResult.Text = CubedX
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
'back to the menu
Me.Close()
frmMenu.Show()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
REM Clear text from boxes and labels
txtYValue.Text = 0
txtXvalue.Text = 0
lblAddResult.Text = 0
lblSubResult.Text = 0
lblMultiResult.Text = 0
lblDivResult.Text = 0
lblSquareResult.Text = 0
lblSquareRootResult.Text = 0
End Sub
Private Sub frmCalculator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
REM Copy UserName to label
lblUserName.Text = UserName
REM Setup unusual characters
lblSquareLabel.Text = "x" & Chr(178)
lblSquareRootLabel.Text = Chr(214) & Chr(67)
End Sub
End Class