Return FileName Only when using OpenFileDialog

后端 未结 8 823
孤独总比滥情好
孤独总比滥情好 2020-12-06 04:34

I am using the following method to browse for a file:

    OpenFileDialog.ShowDialog()
    PictureNameTextEdit.Text = OpenFileDialog.FileName
<
8条回答
  •  孤街浪徒
    2020-12-06 04:59

    if you want just the selected name without Extension you can try this code

    Imports System.IO
    
    
    PictureNameTextEdit.Text = Path.GetFileNameWithoutExtension(OpenFileDialog1.Fi‌​leName)
    

    thanx

提交回复
热议问题