home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
3ctrls
/
calculat.frm
< prev
next >
Wrap
Text File
|
1994-05-17
|
15KB
|
416 lines
VERSION 2.00
Begin Form Calculator
Caption = "Formula Processor"
ClientHeight = 4455
ClientLeft = 405
ClientTop = 1455
ClientWidth = 6240
Height = 4920
KeyPreview = -1 'True
Left = 315
LinkTopic = "Form2"
ScaleHeight = 4455
ScaleWidth = 6240
Top = 1080
Width = 6420
Begin VideoSoftAwk Awk
FS = " , "
Left = 4710
Top = 2850
End
Begin VideoSoftElastic VSElastic1
AccessKey = -1 'True
Align = 5 'Fill Container
AutoSizeChildren= 3 'Even Vertical
BackColor = &H00C0C0C0&
BevelInner = 7 'Shadow
BevelInnerWidth = 4
BevelOuterWidth = 3
BorderWidth = 12
Caption = " &Results "
CaptionPos = 6 'Right Top
ChildSpacing = 10
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 2640
Index = 8
IntBkg = &H00C0C0C0&
Left = 0
ShadowColor = &H00404040&
Style = 1 'Frame Top
TabIndex = 10
TagPosition = 1 'Above Control
Top = 0
Width = 4215
Begin TextBox Results
Alignment = 1 'Right Justify
BackColor = &H00FFFF00&
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 2040
Left = 180
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 11
Tag = "&Results"
Top = 420
Width = 3855
End
End
Begin VideoSoftElastic VSElastic1
AccessKey = -1 'True
Align = 4 'Align Right
AutoSizeChildren= 3 'Even Vertical
BackColor = &H00C0C0C0&
BevelInner = 0 'None
BevelInnerWidth = 2
BevelOuterWidth = 3
BorderWidth = 7
Caption = " &Variables "
CaptionPos = 0 'Left Top
ChildSpacing = -1
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 2640
Index = 1
IntBkg = &H00C0C0C0&
Left = 4215
ShadowColor = &H000000FF&
Style = 1 'Frame Top
TabIndex = 3
Top = 0
Width = 2025
Begin VideoSoftElastic VSElastic1
AccessKey = -1 'True
AutoSizeChildren= 1 'Even Horizontal
BackColor = &H00C0C0C0&
BevelInner = 7 'Shadow
BevelInnerWidth = 3
BevelOuter = 0 'None
BorderWidth = 4
CaptionPos = 6 'Right Top
FontBold = -1 'True
FontItalic = -1 'True
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 735
Index = 0
IntBkg = &H00C0C0C0&
Left = 105
ShadowColor = &H00000000&
TabIndex = 12
TagPosition = 1 'Above Control
TagWidth = 250
Top = 1080
Width = 1815
Begin TextBox Memory
Alignment = 1 'Right Justify
BackColor = &H0000FFFF&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 360
Index = 4
Left = 960
MultiLine = -1 'True
TabIndex = 8
Tag = "E"
Text = "5 "
Top = 315
Width = 795
End
Begin TextBox Memory
Alignment = 1 'Right Justify
BackColor = &H0000FFFF&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 360
Index = 1
Left = 60
MultiLine = -1 'True
TabIndex = 5
Tag = "B"
Text = "2 "
Top = 315
Width = 810
End
End
Begin VideoSoftElastic VSElastic1
AccessKey = -1 'True
AutoSizeChildren= 1 'Even Horizontal
BackColor = &H00C0C0C0&
BevelInner = 7 'Shadow
BevelInnerWidth = 3
BevelOuter = 0 'None
BorderWidth = 4
CaptionPos = 6 'Right Top
FontBold = -1 'True
FontItalic = -1 'True
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 735
Index = 3
IntBkg = &H00C0C0C0&
Left = 105
ShadowColor = &H00000000&
TabIndex = 13
TagPosition = 1 'Above Control
TagWidth = 250
Top = 1800
Width = 1815
Begin TextBox Memory
Alignment = 1 'Right Justify
BackColor = &H0000FFFF&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 360
Index = 5
Left = 960
MultiLine = -1 'True
TabIndex = 9
Tag = "F"
Text = "6 "
Top = 315
Width = 795
End
Begin TextBox Memory
Alignment = 1 'Right Justify
BackColor = &H0000FFFF&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 360
Index = 2
Left = 60
MultiLine = -1 'True
TabIndex = 6
Tag = "C"
Text = "3 "
Top = 315
Width = 810
End
End
Begin VideoSoftElastic VSElastic1
AccessKey = -1 'True
AutoSizeChildren= 1 'Even Horizontal
BackColor = &H00C0C0C0&
BevelInner = 7 'Shadow
BevelInnerWidth = 3
BevelOuter = 0 'None
BorderWidth = 4
CaptionPos = 6 'Right Top
FontBold = -1 'True
FontItalic = -1 'True
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 750
Index = 2
IntBkg = &H00C0C0C0&
Left = 105
ShadowColor = &H00000000&
TabIndex = 14
TagPosition = 1 'Above Control
TagWidth = 250
Top = 345
Width = 1815
Begin TextBox Memory
Alignment = 1 'Right Justify
BackColor = &H0000FFFF&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 375
Index = 3
Left = 960
MultiLine = -1 'True
TabIndex = 7
Tag = "D"
Text = "4 "
Top = 315
Width = 795
End
Begin TextBox Memory
Alignment = 1 'Right Justify
BackColor = &H0000FFFF&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 375
Index = 0
Left = 60
MultiLine = -1 'True
TabIndex = 4
Tag = "A"
Text = "1 "
Top = 315
Width = 810
End
End
End
Begin VideoSoftElastic VSElastic1
AccessKey = -1 'True
Align = 2 'Align Bottom
AutoSizeChildren= 2 'Uneven Horizontal
BackColor = &H00C0C0C0&
BevelInner = 7 'Shadow
BevelInnerWidth = 4
BevelOuterWidth = 3
BorderWidth = 12
Caption = " Build your own &Formula "
ChildSpacing = 12
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 1815
Index = 7
IntBkg = &H00C0C0C0&
Left = 0
ShadowColor = &H00404040&
Style = 1 'Frame Top
TabIndex = 0
Top = 2640
Width = 6240
Begin TextBox Formula
BackColor = &H00FFFFFF&
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00000000&
Height = 1215
Left = 180
TabIndex = 1
Text = "log(a)+b^3+(67-(B*E))"
Top = 420
Width = 4905
End
Begin CommandButton Enter
BackColor = &H00C0C0C0&
Caption = "├"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Wingdings"
FontSize = 19.5
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 1215
Left = 5265
TabIndex = 2
Top = 420
Width = 795
End
End
End
Option Explicit
Sub Awk_Variable (Variable As String, Value As Single, Accept As Integer)
Accept% = True
Select Case Variable$
Case "A", "a": Value! = Val(Memory(0))
Case "B", "b": Value! = Val(Memory(1))
Case "C", "c": Value! = Val(Memory(2))
Case "D", "d": Value! = Val(Memory(3))
Case "E", "e": Value! = Val(Memory(4))
Case "F", "f": Value! = Val(Memory(5))
Case Else: Accept% = False ' refuse garbage
End Select
End Sub
Sub Enter_Click ()
Dim a$
awk = Formula
a = Format(awk.Val)
Select Case awk.Error
Case 6: a = "Bad Syntax"
Case 7: a = "Bad Variable"
Case 8: a = "Missing Bracket"
Case 9: a = "Div by Zero"
End Select
Results = Formula + " = " + Chr(13) + Chr(10) + a + " " + Chr(13) + Chr(10) + Chr(13) + Chr(10) + Results
End Sub
Sub Form_KeyPress (KeyAscii As Integer)
If KeyAscii <> 13 Then Exit Sub
KeyAscii = 0
Enter_Click
End Sub
Sub Formula_GotFocus ()
Formula.SelStart = 0
Formula.SelLength = 30000
End Sub
Sub Memory_GotFocus (Index As Integer)
Memory(Index).SelStart = 0
Memory(Index).SelLength = 30000
Memory(Index).FontBold = True
End Sub
Sub Memory_LostFocus (Index As Integer)
Memory(Index) = Format(Val(Memory(Index))) + " "
Memory(Index).FontBold = False
End Sub
Sub Results_DblClick ()
Results = ""
End Sub