Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Simple Calculator. Any one can develop it! ...
Author:
Anan
E-mail:
Click to e-mail author
Submitted:
11/4/2000
Version:
VB6
Compatibility:
VB6
Category:
Mathematics
Views:
12515
Simple Calculator. Any one can develop it!
Declarations:
Option Explicit
Code:
Dim operand1 As Double, operand2 As Double Dim operator As String Dim result As Double Private Sub ClearD_Click() Display.Caption = " " End Sub Private Sub Cosine_Click() Display.Caption = Cos(Val(Display.Caption)) End Sub Private Sub Digits_Click(Index As Integer) If ClearD Then Display.Caption = " " ClearD = False Else Display.Caption = Display.Caption + Digits(Index).Caption End If End Sub Private Sub Div_Click() operand1 = Val(Display.Caption) operator = "/" Display.Caption = " " End Sub Private Sub dot_Click() If InStr(Display.Caption, ".") Then Exit Sub Else Display.Caption = Display.Caption + "." End Sub Private Sub Equals_Click() operand2 = Val(Display.Caption) If operator = "+" Then result = operand1 + operand2 If operator = "-" Then result = operand1 - operand2 If operator = "*" Then result = operand1 * operand2 If operator = "/" And operand2 <> 0 Then result = operand1 / operand2 Display.Caption = result End Sub Private Sub Logaritim_Click() Display.Caption = 0.4343 * Log(Val(Display.Caption)) End Sub Private Sub Minus_Click() operand1 = Val(Display.Caption) operator = "-" Display.Caption = " " End Sub Private Sub Multiply_Click() operand1 = Val(Display.Caption) operator = "*" Display.Caption = " " End Sub Private Sub Plus_Click() operand1 = Val(Display.Caption) operator = "+" Display.Caption = " " End Sub Private Sub Sine_Click() Display.Caption = Sin(Val(Display.Caption)) End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement