Answer
Using controls in this form
4 Option Button(Add,Subtract,Multiple,Divide)
3 Textbox (3 textbox text properties are clear)
4 Label (Multi purpose Calculator,Enter the first no,Enter second no, Result)
3 Command Button (Find,Clear,Exit)
Source Code for Multi Purpose Calculator
Private Sub Command1_Click()
'Addition textbox1 and textbox2 ,result is store textbox3
If (Option1.Value = True) Then
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
If (Option1.Value = True) Then
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
Else
'Subtraction textbox1 and textbox2 ,result is store textbox3
If (Option2.Value = True) Then
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
If (Option2.Value = True) Then
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
Else
'Multiplication textbox1 and textbox2 ,result is store textbox3
If (Option3.Value = True) Then
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
Else
'Divide textbox1 and textbox2 ,result is store textbox3
If (Option4.Value = True) Then
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End If
End If
End If
End If
End Sub
Private Sub Command2_Click()
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End If
End If
End If
End If
End Sub
Private Sub Command2_Click()
'Clear all Textbox
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command3_Click()
'Exit current program
End
End Sub
End
End Sub
No comments:
Post a Comment