ok try this
vb Code:
Public Class Form1 Dim files() As String Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged MsgBox(files(ListBox1.SelectedIndex)) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If OpenFileDialog1.ShowDialog = DialogResult.OK Then files = OpenFileDialog1.FileNames ListBox1.Items.Clear() For x As Integer = 0 To files.GetUpperBound(0) ListBox1.Items.Add(IO.Path.GetFileName(files(x))) Next End If End Sub End Class




Reply With Quote