VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Code to make a calculator '************Made By Muhammad Zeeshan Naeem********** ' [email protected]

by Muhammad Zeeshan Naeem (2 Submissions)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 24th November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Code to make a calculator '************Made By Muhammad Zeeshan Naeem********** ' [email protected]

API Declarations


Dim opr1 As Double
Dim opr2 As Double
Dim di As Double
Dim op As String
Dim cleardisplay As Boolean

Rate Code to make a calculator '************Made By Muhammad Zeeshan Naeem********** ' [email protected]



[email protected]
*****************************************************
' to make a button fron 0 to 9 fallow the steps
'1: click on button from tollbar and past on form
'2: copy that button by rclick and past it 9 time on the form  vb prompt
' u "yes" and "no" u click on "yes", and make array of the button make it caption 0,1,2,3,4,5,6,7,8,9 respectively
 ' use the label for screen 
 ' use option button 4 on off  



Private Sub Command1_Click(Index As Integer)
'make 10 buttons with captions "0,1,2,3,4,5,6,7,8,9" it is an array 

If Label1.Caption = "0" Then
Label1.Caption = " "
End If
Label1.Caption = Label1.Caption + Command1(Index).Caption
End Sub

Private Sub Command10_Click()
' make a button it caption " square"
Label1.Caption = Sqr(Val(Label1.Caption))
End Sub
Private Sub Command11_Click()
opr1 = Label1.Caption
op = "\"
Label1.Caption = " "
End Sub
Private Sub Command12_Click()
'make a button it caption "+/-"
Label1.Caption = -Val(Label1.Caption)
End Sub

Private Sub Command2_Click()
'make a button it caption "."
If InStr(Label1.Caption, ".") Then
 Exit Sub
 Else
Label1.Caption = Label1.Caption + "."
End If
End Sub

Private Sub Command3_Click()
'make a button it caption "C/A"
Label1.Caption = " "
End Sub

Private Sub Command4_Click()
'make a button it caption "="
If op = "+" Then
di = opr1 + Val(Label1.Caption)
ElseIf op = "-" Then
di = opr1 - Val(Label1.Caption)
ElseIf op = "/" And Val(Label1.Caption) <> 0 Then
di = opr1 / Val(Label1.Caption)
ElseIf op = "\" And Val(Label1.Caption) <> 0 Then
di = opr1 \ Val(Label1.Caption)
End If
Label1.Caption = di

End Sub

Private Sub Command5_Click()
'make a button it caption "X"
opr1 = Val(Label1.Caption)
op = "*"
Label1.Caption = " "
End Sub

Private Sub Command6_Click()
'make a button it caption "/"
opr1 = Val(Label1.Caption)
op = "/"
Label1.Caption = " "
End Sub

Private Sub Command7_Click()
'make a button it caption "-"
opr1 = Val(Label1.Caption)
op = "-"
Label1.Caption = " "

End Sub

Private Sub Command8_Click()
'make a button it caption "+"
opr1 = Val(Label1.Caption)
op = "+"
Label1.Caption = " "

End Sub

Private Sub Command9_Click()
'make a button it caption "X**2"
Label1.Caption = Val(Label1.Caption) * Val(Label1.Caption)
'op = "s"
'Label1.Caption = " "
End Sub
'4 any question contact me

[email protected]
'****************************************************


Private Sub Form_Load()
Label1.BackColor = vbBlack
End Sub

Private Sub Option1_Click()
'make a optin button it caption "on"
'Option1.Caption = "OFF"
If Option1.Value = True Then
Label1.BackColor = Form1.BackColor
Option1.Visible = False
Option2.Visible = True

Label1.Caption = 0
End If
End Sub

Private Sub Option2_Click()

If Option2.Value = True Then
'make a optin button it caption "off" 
Option2.Visible = False
Option1.Visible = True
Label1.BackColor = vbBlack
End If
End Sub
'4 any question contact me

[email protected]
'****************************************************



Download this snippet    Add to My Saved Code

Code to make a calculator '************Made By Muhammad Zeeshan Naeem********** ' [email protected] Comments

No comments have been posted about Code to make a calculator '************Made By Muhammad Zeeshan Naeem********** ' [email protected]. Why not be the first to post a comment about Code to make a calculator '************Made By Muhammad Zeeshan Naeem********** ' [email protected].

Post your comment

Subject:
Message:
0/1000 characters