
دوست داري
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Cal"
ClientHeight = 2985
ClientLeft = 45
ClientTop = 330
ClientWidth = 2130
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2985
ScaleWidth = 2130
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command10
Caption = "About"
Height = 285
Left = 150
TabIndex = 19
Top = 540
Width = 915
End
Begin VB.CommandButton Command9
Caption = "E"
Height = 315
Left = 150
TabIndex = 18
Top = 2190
Width = 375
End
Begin VB.CommandButton Command8
Caption = "C"
Height = 315
Left = 1650
TabIndex = 17
Top = 540
Width = 315
End
Begin VB.CommandButton Command7
Caption = "."
Height = 315
Left = 1170
TabIndex = 16
Top = 2190
Width = 375
End
Begin VB.CommandButton Command6
Caption = "="
Height = 315
Left = 960
TabIndex = 15
Top = 2610
Width = 1005
End
Begin VB.CommandButton Command5
Caption = "/"
Height = 315
Left = 1650
TabIndex = 14
Top = 2190
Width = 315
End
Begin VB.CommandButton Command4
Caption = "*"
Height = 315
Left = 1650
TabIndex = 13
Top = 1770
Width = 315
End
Begin VB.CommandButton Command3
Caption = "+"
Height = 315
Left = 1650
TabIndex = 12
Top = 1350
Width = 315
End
Begin VB.CommandButton Command2
Caption = "-"
Height = 315
Left = 1650
TabIndex = 11
Top = 930
Width = 315
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 9
Left = 1170
TabIndex = 10
Top = 1770
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 8
Left = 660
TabIndex = 9
Top = 1770
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 7
Left = 150
TabIndex = 8
Top = 1770
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 6
Left = 1170
TabIndex = 7
Top = 1350
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 5
Left = 660
TabIndex = 6
Top = 1350
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 4
Left = 150
TabIndex = 5
Top = 1350
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 3
Left = 1170
TabIndex = 4
Top = 930
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 2
Left = 660
TabIndex = 3
Top = 930
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 1
Left = 150
TabIndex = 2
Top = 930
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 315
Index = 0
Left = 660
TabIndex = 1
Top = 2190
Width = 375
End
Begin VB.TextBox Text1
Height = 345
Left = 60
TabIndex = 0
Top = 90
Width = 1935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Data1 As Double, Data2 As Double, InO As Integer, SettextZ As Boolean, OpValue As Double
Private Sub Command1_Click(Index As Integer)
If SettextZ Then
SettextZ = False
Text1 = ""
End If
Text1.SelText = ext1 + Chr(Index + 48)
Text1.SetFocus
End Sub
Private Sub Command10_Click()
MsgBox "Programed by SMK -1998/9/15"
End Sub
Private Sub Command2_Click()
Opraiting (1)
End Sub
Private Sub Command3_Click()
Opraiting (2)
End Sub
Private Sub Command4_Click()
Opraiting (3)
End Sub
Private Sub Command5_Click()
Opraiting (4)
End Sub
Private Sub Command6_Click()
Opraiting (5)
End Sub
Private Sub Command8_Click()
Data1 = 0
Data2 = 0
Text1 = ""
InO = 0
SettextZ = False
Text1.SetFocus
End Sub
Private Sub Command9_Click()
Text1 = Text1 + "E"
End Sub
Private Sub Form_Load()
For i = 0 To 9
Command1(i).Caption = i
Next
SettextZ = False
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim Data1 As Double
If Chr(KeyAscii) = "." Then GoTo Exit_sub1
If Chr(KeyAscii) = "E" Then GoTo Exit_sub1
If Chr(KeyAscii) = "e" Then GoTo Exit_sub1
If KeyAscii < 48 Then GoTo check_1
If KeyAscii > 57 Then GoTo check_1
Exit_sub1:
If SettextZ Then
SettextZ = False
If Chr(KeyAscii) = "e" Or Chr(KeyAscii) = "E" Then
Text1 = ""
Text1.SelText = "1e"
KeyAscii = 0
ElseIf Chr(KeyAscii) = "." Then
Text1 = ""
Text1.SelText = "0."
KeyAscii = 0
Else
Text1 = ""
End If
End If
Exit Sub
check_1:
Select Case Chr(KeyAscii)
Case "-"
Opraiting (1)
Case "+"
Opraiting (2)
Case "*"
Opraiting (3)
Case "/"
Opraiting (4)
Case "="
Opraiting (5)
End Select
If KeyAscii = 13 Then Opraiting (5)
KeyAscii = 0
Exit Sub
End Sub
Function Opraiting(inp)
If inp = 5 Then
SettextZ = True
Data2 = Val(Text1)
Select Case InO
Case 0
OpValue = Data2
Case 1
OpValue = Data1 - Data2
Case 2
OpValue = Data1 + Data2
Case 3
OpValue = Data1 * Data2
Case 4
OpValue = Data1 / Data2
End Select
Text1 = ""
Text1.SelText = OpValue
InO = 0
Else
If InO <> 0 Then Opraiting (5)
InO = inp
SettextZ = True
Data1 = Val(Text1)
End If
Text1.SetFocus
End Function