home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_1 / BASE_XP / CALC1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-01-25  |  2.3 KB  |  88 lines

  1. VERSION 2.00
  2. Begin Form calctest 
  3.    Caption         =   "Sample Expression Evaluator"
  4.    ClientHeight    =   4020
  5.    ClientLeft      =   1680
  6.    ClientTop       =   1410
  7.    ClientWidth     =   7365
  8.    Height          =   4425
  9.    Left            =   1620
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4020
  12.    ScaleWidth      =   7365
  13.    Top             =   1065
  14.    Width           =   7485
  15.    Begin CommandButton Command2 
  16.       Caption         =   "Iterate 10000"
  17.       Height          =   495
  18.       Left            =   4440
  19.       TabIndex        =   4
  20.       Top             =   1440
  21.       Width           =   1695
  22.    End
  23.    Begin TextBox answer 
  24.       Enabled         =   0   'False
  25.       Height          =   375
  26.       Left            =   2700
  27.       TabIndex        =   3
  28.       Top             =   2640
  29.       Width           =   4095
  30.    End
  31.    Begin CommandButton Command1 
  32.       Caption         =   "Calculate"
  33.       Height          =   495
  34.       Left            =   2580
  35.       TabIndex        =   2
  36.       Top             =   1440
  37.       Width           =   1215
  38.    End
  39.    Begin TextBox Text1 
  40.       Height          =   315
  41.       Left            =   2580
  42.       TabIndex        =   1
  43.       Text            =   "((3 + 4) * 5 - 2) * 2 - 1"
  44.       Top             =   540
  45.       Width           =   4035
  46.    End
  47.    Begin Label Label2 
  48.       Caption         =   "Answer"
  49.       Height          =   315
  50.       Left            =   1740
  51.       TabIndex        =   5
  52.       Top             =   2640
  53.       Width           =   915
  54.    End
  55.    Begin Label Label1 
  56.       Alignment       =   1  'Right Justify
  57.       Caption         =   "Formula"
  58.       Height          =   195
  59.       Left            =   1260
  60.       TabIndex        =   0
  61.       Top             =   600
  62.       Width           =   1275
  63.    End
  64. Option Explicit
  65. Sub Command1_Click ()
  66. answer.Text = ""
  67. answer.Text = eval((text1.Text))
  68. End Sub
  69. Sub Command2_Click ()
  70. Dim p$, i%, t$
  71. p = text1.Text
  72. screen.MousePointer = 11
  73. MousePointer = 11
  74. Refresh
  75. For i = 1 To 10000
  76. t = eval(p)
  77. screen.MousePointer = 0
  78. MousePointer = 0
  79. answer.Text = t
  80. End Sub
  81. Sub Form_Load ()
  82.  initcalc
  83. End Sub
  84. Sub Text1_GotFocus ()
  85. text1.SelStart = 0
  86. text1.SelLength = Len(text1.Text)
  87. End Sub
  88.