Our instructor told us to make a scientific calculator using visual basic... though he didn't yet discuss on how... what i made was just a simple calculator that can perform the four basic functions... here is my codes...
Dim val1 As Double
Dim a As Double, s As Double, m As Double, d As Double
'for addition
Private Sub Command1_Click()
If val1 <> 0 Then
Text1.Text = (a + Text1.Text) + (s - Text1.Text) + (m * Text1.Text) + (d / Text1.Text)
End If
a = Text1.Text
s = 0
m = 1
d = 0
val1 = Text1.Text
End Sub
'for subtraction
Private Sub Command2_Click()
If val1 <> 0 Then
Text1.Text = (a + Text1.Text) + (s - Text1.Text) + (m * Text1.Text) + (d / Text1.Text)
End If
a = 0
s = Text1.Text
m = -1
d = 0
val1 = Text1.Text
End Sub
'for multiplication
Private Sub Command3_Click()
If val1 <> 0 Then
Text1.Text = (a + Text1.Text) + (s - Text1.Text) + (m * Text1.Text) + (d / Text1.Text)
End If
a = 0
s = 0
m = Text1.Text
d = 0
val1 = Text1.Text
End Sub
'for division
Private Sub Command4_Click()
If val1 <> 0 Then
Text1.Text = (a + Text1.Text) + (s - Text1.Text) + (m * Text1.Text) + (d / Text1.Text)
End If
a = 0
s = 0
m = 0
d = Text1.Text
val1 = Text1.Text
End Sub
'for equal
Private Sub Command5_Click()
If val1 <> 0 Then
Text1.Text = (a + Text1.Text) + (s - Text1.Text) + (m * Text1.Text) + (d / Text1.Text)
End If
a = 0
s = 0
m = 1
d = 0
val1 = Text1.Text
End Sub
i hope someone could help me make a scientific calculator.... Adding only %, Oct, factorial, squared, cubed, hex (A,B,C,D,E,F) i think that's it... hope someone could help... thanks in advance