VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Its a Simple Calculator. You Just need 3 textboxes, one as txtinputval1, one as txtinputval2, one a

by Bobbert (4 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 30th September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Its a Simple Calculator. You Just need 3 textboxes, one as txtinputval1, one as txtinputval2, one as lblanswerval, a picture box called

Rate Its a Simple Calculator. You Just need 3 textboxes, one as txtinputval1, one as txtinputval2, one a



Dim MouseLocationX As Integer
Dim MouseLocationY As Integer


Private Sub cmdclear_Click()
txtinputval1.Text = ""
txtinputval2.Text = ""
lblanswerval.Text = ""
'clear code
End Sub

Private Sub cmddivide_Click()
Dim f, s As Integer
f = Val(txtinputval1.Text)
s = Val(txtinputval2.Text)
lblanswerval.Text = Val(f / s)
Picture1.Print Val(f); " Divided by "; Val(s); " Is "; Val(f / s)
'division code with a bit of my own originality
End Sub

Private Sub cmdminus_Click()
Dim f, s As Integer
f = Val(txtinputval1.Text)
s = Val(txtinputval2.Text)
lblanswerval.Text = Val(f - s)
Picture1.Print Val(f); " Minus "; Val(s); " Is "; Val(f - s)
'subtraction code with the same originality
End Sub

Private Sub cmdmultiply_Click()
Dim f, s As Integer
f = Val(txtinputval1.Text)
s = Val(txtinputval2.Text)
lblanswerval.Text = Val(f * s)
Picture1.Print Val(f); " Times "; Val(s); " Is "; Val(f * s)
'multiplication
End Sub

Private Sub cmdplus_Click()
Dim f, s As Integer
f = Val(txtinputval1.Text)
s = Val(txtinputval2.Text)
lblanswerval.Text = Val(f + s)
Picture1.Print Val(f); " Plus "; Val(s); " Is "; Val(f + s)
'addition
End Sub

Private Sub cmdsquare_Click()
f = txtinputval1.Text
s = txtinputval1.Text
answer = Sqr(f)
lblanswerval.Text = answer
Picture1.Print answer; " is the square root of "; Val(s)
'square rootness
End Sub

Private Sub Command1_Click()
Picture1.Cls
'clear the log
End Sub

Private Sub Form_Load()
Timer1.Enabled = True
'simple timer on formload
End Sub

Private Sub lblend_Click()
End
'end whee
End Sub

Private Sub lblmax_Click()
WindowState = vbMaximized
'windowstates here
End Sub

Private Sub lblmin_Click()
WindowState = vbMinimized
'and here
End Sub

Private Sub Timer1_Timer()
txtinputval1.SetFocus
If Timer1.Enabled = True Then
Timer1.Enabled = False
End If
'turn off the timer after the setfocus is used
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MousePress = 1
MouseLocationX = X
MouseLocationY = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MousePress = 1 Then
    Frmmain.Top = Frmmain.Top + Y
    Frmmain.Left = Frmmain.Left + X
End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MousePress = 0
End Sub


Download this snippet    Add to My Saved Code

Its a Simple Calculator. You Just need 3 textboxes, one as txtinputval1, one as txtinputval2, one a Comments

No comments have been posted about Its a Simple Calculator. You Just need 3 textboxes, one as txtinputval1, one as txtinputval2, one a. Why not be the first to post a comment about Its a Simple Calculator. You Just need 3 textboxes, one as txtinputval1, one as txtinputval2, one a.

Post your comment

Subject:
Message:
0/1000 characters