Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Friend WithEvents ListBox1 As System.Windows.Forms.ListBox Friend WithEvents bttnFile As System.Windows.Forms.Button Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog 'Required by the Windows Form Designer Private components As System.ComponentModel.Container 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() Me.bttnFile = New System.Windows.Forms.Button() Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.ListBox1 = New System.Windows.Forms.ListBox() Me.SuspendLayout() ' 'bttnFile ' Me.bttnFile.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.bttnFile.Location = New System.Drawing.Point(0, 8) Me.bttnFile.Name = "bttnFile" Me.bttnFile.Size = New System.Drawing.Size(112, 32) Me.bttnFile.TabIndex = 1 Me.bttnFile.Text = "Open Files" ' 'ListBox1 ' Me.ListBox1.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right) Me.ListBox1.Font = New System.Drawing.Font("Verdana", 9!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ListBox1.ItemHeight = 14 Me.ListBox1.Location = New System.Drawing.Point(0, 48) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(408, 214) Me.ListBox1.TabIndex = 0 ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(408, 261) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.bttnFile, Me.ListBox1}) Me.Name = "Form1" Me.Text = "Multiple File Selection" Me.ResumeLayout(False) End Sub #End Region Private Sub bttnFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttnFile.Click OpenFileDialog1.Multiselect = True OpenFileDialog1.ShowDialog() Dim filesEnum As IEnumerator ListBox1.Items.Clear() filesEnum = OpenFileDialog1.FileNames.GetEnumerator() While filesEnum.MoveNext ListBox1.Items.Add(filesEnum.Current) End While End Sub End Class