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-ProvideFileDialog / Form1.vb < prev   
Text File  |  2001-07-19  |  2KB  |  74 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 OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
  26.     Friend WithEvents Button1 As System.Windows.Forms.Button
  27.  
  28.     'Required by the Windows Form Designer
  29.     Private components As System.ComponentModel.Container
  30.  
  31.     'NOTE: The following procedure is required by the Windows Form Designer
  32.     'It can be modified using the Windows Form Designer.  
  33.     'Do not modify it using the code editor.
  34.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  35.         Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
  36.         Me.Button1 = New System.Windows.Forms.Button()
  37.         Me.SuspendLayout()
  38.         '
  39.         'OpenFileDialog1
  40.         '
  41.         Me.OpenFileDialog1.DefaultExt = "*.txt"
  42.         Me.OpenFileDialog1.Filter = "Text files (*.txt)|*.txt"
  43.         '
  44.         'Button1
  45.         '
  46.         Me.Button1.Location = New System.Drawing.Point(80, 80)
  47.         Me.Button1.Name = "Button1"
  48.         Me.Button1.Size = New System.Drawing.Size(136, 40)
  49.         Me.Button1.TabIndex = 0
  50.         Me.Button1.Text = "Button1"
  51.         '
  52.         'Form1
  53.         '
  54.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  55.         Me.ClientSize = New System.Drawing.Size(292, 273)
  56.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
  57.         Me.Name = "Form1"
  58.         Me.Text = "Form1"
  59.         Me.ResumeLayout(False)
  60.  
  61.     End Sub
  62.  
  63. #End Region
  64.  
  65.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  66.         Dim result As DialogResult
  67.         result = OpenFileDialog1.ShowDialog()
  68.  
  69.         If result = DialogResult.OK Then
  70.             MessageBox.Show("Opening..." & OpenFileDialog1.FileName)
  71.         End If
  72.     End Sub
  73. End Class
  74.