home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch04 / rtmenu / rtmenu.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-04-13  |  2.2 KB  |  80 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Menu Demo"
  4.    ClientHeight    =   3195
  5.    ClientLeft      =   165
  6.    ClientTop       =   735
  7.    ClientWidth     =   4680
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3195
  10.    ScaleWidth      =   4680
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton RemoveCommand 
  13.       Caption         =   "Remove Run Time Option"
  14.       Height          =   570
  15.       Left            =   2310
  16.       TabIndex        =   1
  17.       Top             =   2430
  18.       Width           =   2205
  19.    End
  20.    Begin VB.CommandButton AddCommand 
  21.       Caption         =   "Add Run Time Option"
  22.       Height          =   540
  23.       Left            =   2280
  24.       TabIndex        =   0
  25.       Top             =   1785
  26.       Width           =   2235
  27.    End
  28.    Begin VB.Menu FileMenu 
  29.       Caption         =   "File"
  30.       Begin VB.Menu FileOpen 
  31.          Caption         =   "Open"
  32.       End
  33.       Begin VB.Menu FileSave 
  34.          Caption         =   "Save"
  35.       End
  36.       Begin VB.Menu FileExit 
  37.          Caption         =   "Exit"
  38.       End
  39.    End
  40.    Begin VB.Menu EditMenu 
  41.       Caption         =   "Edit"
  42.       Begin VB.Menu EditCopy 
  43.          Caption         =   "Copy"
  44.       End
  45.       Begin VB.Menu EditCut 
  46.          Caption         =   "Cut"
  47.       End
  48.       Begin VB.Menu EditPaste 
  49.          Caption         =   "Paste"
  50.       End
  51.    End
  52.    Begin VB.Menu RunTimeMenu 
  53.       Caption         =   "Run Time Menu"
  54.       Begin VB.Menu RunTimeOptions 
  55.          Caption         =   "Run Time Option"
  56.          Index           =   0
  57.       End
  58.    End
  59. Attribute VB_Name = "Form1"
  60. Attribute VB_GlobalNameSpace = False
  61. Attribute VB_Creatable = False
  62. Attribute VB_PredeclaredId = True
  63. Attribute VB_Exposed = False
  64. Option Explicit
  65. Dim RTmenu As Integer
  66. Private Sub AddCommand_Click()
  67.     RTmenu = RTmenu + 1
  68.     If RTmenu = 1 Then RunTimeOptions(0).Caption = "Run Time Options"
  69.     Load RunTimeOptions(RTmenu)
  70.     RunTimeOptions(RTmenu).Caption = "Option # " & RTmenu
  71. End Sub
  72. Private Sub RemoveCommand_Click()
  73.     If RTmenu = 0 Then
  74.         MsgBox "Menu is empty"
  75.         Exit Sub
  76.     End If
  77.     Unload RunTimeOptions(RTmenu)
  78.     RTmenu = RTmenu - 1
  79. End Sub
  80.