home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH7 / 7-2-2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-18  |  3.0 KB  |  106 lines

  1. VERSION 5.00
  2. Begin VB.Form frm7_2_2 
  3.    Caption         =   "Stocks"
  4.    ClientHeight    =   3840
  5.    ClientLeft      =   1080
  6.    ClientTop       =   2025
  7.    ClientWidth     =   4680
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   3840
  20.    ScaleWidth      =   4680
  21.    Begin VB.PictureBox picStocks 
  22.       Height          =   2535
  23.       Left            =   120
  24.       ScaleHeight     =   2475
  25.       ScaleWidth      =   4395
  26.       TabIndex        =   4
  27.       Top             =   1200
  28.       Width           =   4455
  29.    End
  30.    Begin VB.CommandButton cmdSummarize 
  31.       Caption         =   "Summarize"
  32.       Height          =   375
  33.       Left            =   3360
  34.       TabIndex        =   3
  35.       Top             =   720
  36.       Width           =   1215
  37.    End
  38.    Begin VB.CommandButton cmdRecord 
  39.       Caption         =   "Record Name"
  40.       Height          =   375
  41.       Left            =   1800
  42.       TabIndex        =   2
  43.       Top             =   720
  44.       Width           =   1455
  45.    End
  46.    Begin VB.TextBox txtCompany 
  47.       Height          =   285
  48.       Left            =   1800
  49.       TabIndex        =   1
  50.       Text            =   " "
  51.       Top             =   360
  52.       Width           =   2775
  53.    End
  54.    Begin VB.Label lblInstructions 
  55.       Caption         =   "Enter up to 100 companies whose stock you own."
  56.       Height          =   255
  57.       Left            =   120
  58.       TabIndex        =   5
  59.       Top             =   0
  60.       Width           =   4335
  61.    End
  62.    Begin VB.Label lblName 
  63.       Caption         =   "Name of company:"
  64.       Height          =   255
  65.       Left            =   120
  66.       TabIndex        =   0
  67.       Top             =   360
  68.       Width           =   1695
  69.    End
  70. Attribute VB_Name = "frm7_2_2"
  71. Attribute VB_GlobalNameSpace = False
  72. Attribute VB_Creatable = False
  73. Attribute VB_PredeclaredId = True
  74. Attribute VB_Exposed = False
  75. Dim stock(1 To 100) As String
  76. Dim counter As Integer
  77. Private Sub cmdRecord_Click()
  78.   If (counter < 100) Then
  79.       counter = counter + 1
  80.       stock(counter) = txtCompany.Text
  81.       txtCompany.Text = ""
  82.       txtCompany.SetFocus
  83.     Else
  84.       MsgBox "No space to record additional companies.", , ""
  85.       txtCompany.Text = ""
  86.       cmdSummarize.SetFocus
  87.   End If
  88. End Sub
  89. Private Sub cmdSummarize_Click()
  90.   Dim i As Integer
  91.   'List stock company that have been recorded
  92.   picStocks.Cls
  93.   picStocks.Print "You own the following"; counter; "stocks."
  94.   For i = 1 To counter
  95.     picStocks.Print stock(i) & "  ";
  96.     'Move to new line after every 5 stocks
  97.     If Int(i / 5) = i / 5 Then
  98.         picStocks.Print
  99.     End If
  100.   Next i
  101. End Sub
  102. Private Sub Form_Load()
  103.   'Initialize count of companies
  104.   counter = 0
  105. End Sub
  106.