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

Recommended Answers

All 6 Replies

anyone? help please?

Ok.... I'm not sure exactly what it's going to entail.... do you have the buttons already added for the scientific portion? Attach your project to the next post, and we'll go from there.

I'm sorry for the inconvenience... but i finally figured it out... with the help of some friends... hehehehe.... thanks anyway for your time...

i need help with a scientific calcu. um i dont know exactly how im supposed to start as there are characters in the calcu i cannot show in the buttons like the square root and the like. please help me. i know the codes for the simple operands + - / * and the square root code. but for the sin, cosine, tan and the like, i do not know how.

How about you don't post to three year old threads, that have already been marked solved..... dufus.

How about you don't post to three year old threads, that have already been marked solved..... dufus.

dear comatose,

sorry. it's just that even if it said it's already solved, i couldn't figure out the codes. im an accounting major. and besides, its currently, my assignment when i searched the engine and found some threads, i didn't realize it was ages ago. if it was years ago then why didn't they lock it? don't call me a dufus. it's not polite.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.