<pre lang="vb">Public Class Form1 Dim fdlg As OpenFileDialog = New OpenFileDialog() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click fdlg.Title = "open" fdlg.InitialDirectory = "c:\" fdlg.Filter = "All files(*.*)|*.*|RTF files(*.rtf)|*.rtf|document files(*.doc)|*.doc" fdlg.FilterIndex = 1 fdlg.RestoreDirectory = True If fdlg.ShowDialog = Windows.Forms.DialogResult.OK Then ListBox1.Items.Add(fdlg.FileName) MessageBox.Show("You selected " & fdlg.FileName) End If End Sub
Path.GetFileName(path)
System.IO.Path.GetFileName
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)