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 / Ch5-UsingPrinterDialog / Form1.vb < prev   
Text File  |  2001-07-20  |  3KB  |  81 lines

  1. Public Class Form1
  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 PrintDocument1 As System.Drawing.Printing.PrintDocument
  26.     Friend WithEvents PrintDialog1 As System.Windows.Forms.PrintDialog
  27.     Friend WithEvents Button1 As System.Windows.Forms.Button
  28.  
  29.     'Required by the Windows Form Designer
  30.     Private components As System.ComponentModel.Container
  31.  
  32.     'NOTE: The following procedure is required by the Windows Form Designer
  33.     'It can be modified using the Windows Form Designer.  
  34.     'Do not modify it using the code editor.
  35.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  36.         Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
  37.         Me.PrintDialog1 = New System.Windows.Forms.PrintDialog()
  38.         Me.Button1 = New System.Windows.Forms.Button()
  39.         Me.SuspendLayout()
  40.         '
  41.         'PrintDocument1
  42.         '
  43.         Me.PrintDocument1.DocumentName = "MyDoc"
  44.         '
  45.         'PrintDialog1
  46.         '
  47.         Me.PrintDialog1.AllowSelection = True
  48.         Me.PrintDialog1.AllowSomePages = True
  49.         Me.PrintDialog1.Document = Me.PrintDocument1
  50.         '
  51.         'Button1
  52.         '
  53.         Me.Button1.Location = New System.Drawing.Point(88, 72)
  54.         Me.Button1.Name = "Button1"
  55.         Me.Button1.Size = New System.Drawing.Size(120, 56)
  56.         Me.Button1.TabIndex = 0
  57.         Me.Button1.Text = "Button1"
  58.         '
  59.         'Form1
  60.         '
  61.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  62.         Me.ClientSize = New System.Drawing.Size(292, 273)
  63.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
  64.         Me.Name = "Form1"
  65.         Me.Text = "Form1"
  66.         Me.ResumeLayout(False)
  67.  
  68.     End Sub
  69.  
  70. #End Region
  71.  
  72.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  73.         Dim result As DialogResult
  74.         result = PrintDialog1.ShowDialog()
  75.         If result = DialogResult.OK Then
  76.             PrintDocument1.Print()
  77.         End If
  78.  
  79.     End Sub
  80. End Class
  81.