VB.net如何打开对话框获取文件名?注意不是完整路径还有没有后缀名!

2024-11-01 16:58:30
推荐回答(4个)
回答(1):

Dim dialog As OpenFileDialog = New OpenFileDialog
If dialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim filename As String
filename = dialog.FileName
Dim results() As String
results = filename.Split("\")
filename = results(results.Length - 1)
filename = filename.Substring(0, filename.LastIndexOf("."))
MessageBox.Show(filename)
End If
dialog.Dispose()

回答(2):

system.io.path.getfilename(FilePath)

回答(3):

用祥基vb怎样获得程序本身的文件乎宴滑名和路径?万分感谢 App.Path 路径 App.EXEName 文件名岁腊

回答(4):

filename.split()