home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic .NET - Read Less - Learn More / Visual_Basic.NET_Read_Less_Learn_More_Richard_Bowman_Visual_2002.iso / Resources / Code / Ch2-OwnedForms / FormMain.vb < prev    next >
Text File  |  2001-06-24  |  3KB  |  92 lines

  1. Public Class FormMain
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.  
  14.     End Sub
  15.  
  16.     'Form overrides dispose to clean up the component list.
  17.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  18.         If disposing Then
  19.             If Not (components Is Nothing) Then
  20.                 components.Dispose()
  21.             End If
  22.         End If
  23.         MyBase.Dispose(disposing)
  24.     End Sub
  25.     Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
  26.     Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
  27.     Friend WithEvents MenuFileOpen As System.Windows.Forms.MenuItem
  28.     Friend WithEvents MenuExit As System.Windows.Forms.MenuItem
  29.  
  30.     'Required by the Windows Form Designer
  31.     Private components As System.ComponentModel.Container
  32.  
  33.     'NOTE: The following procedure is required by the Windows Form Designer
  34.     'It can be modified using the Windows Form Designer.  
  35.     'Do not modify it using the code editor.
  36.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  37.         Me.MenuItem1 = New System.Windows.Forms.MenuItem()
  38.         Me.MenuFileOpen = New System.Windows.Forms.MenuItem()
  39.         Me.MenuExit = New System.Windows.Forms.MenuItem()
  40.         Me.MainMenu1 = New System.Windows.Forms.MainMenu()
  41.         '
  42.         'MenuItem1
  43.         '
  44.         Me.MenuItem1.Index = 0
  45.         Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuFileOpen, Me.MenuExit})
  46.         Me.MenuItem1.Text = "&File"
  47.         '
  48.         'MenuFileOpen
  49.         '
  50.         Me.MenuFileOpen.Index = 0
  51.         Me.MenuFileOpen.Text = "&Open..."
  52.         '
  53.         'MenuExit
  54.         '
  55.         Me.MenuExit.Index = 1
  56.         Me.MenuExit.Text = "E&xit"
  57.         '
  58.         'MainMenu1
  59.         '
  60.         Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
  61.         '
  62.         'FormMain
  63.         '
  64.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  65.         Me.ClientSize = New System.Drawing.Size(292, 273)
  66.         Me.Menu = Me.MainMenu1
  67.         Me.Name = "FormMain"
  68.         Me.Text = "Main window"
  69.  
  70.     End Sub
  71.  
  72. #End Region
  73.  
  74.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  75.         Dim Tools As New FormToolWindow()
  76.         Me.AddOwnedForm(Tools)
  77.         Tools.Show()
  78.     End Sub
  79.  
  80.     Private Sub MenuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuExit.Click
  81.         Close()
  82.     End Sub
  83.  
  84.     Public Sub FileOpenRoutine()
  85.         MessageBox.Show("Open a file now!")
  86.     End Sub
  87.  
  88.     Private Sub MenuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuFileOpen.Click
  89.         FileOpenRoutine()
  90.     End Sub
  91. End Class
  92.