如何通过Savefiledialog获取文件名称 [英] How Can I Have The Name Of File Withe Savefiledialog

查看:180
本文介绍了如何通过Savefiledialog获取文件名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



请有人在Visuel studio 2010中有代码,只能获得savefiledialog文件的名称,

没有proprité喜欢openfile gielog中的salefilename



谢谢

解决方案

尝试:

  Dim  sfd  As   SaveFileDialog()
如果 sfd.ShowDialog()= DialogResult.OK 那么
Dim filenameWithPath As String = sfd.FileName
Dim justTheFilename As String = Path.GetFileName(filenameWithPath)
结束 如果


有一个名为 FileName 的属性,可以是 set get 带有完整的文件名(包括路径)。



看看这个 MSDN示例 [ ^ ]


hello

please anyone has code in Visuel studio 2010, to get only the name of file withe savefiledialog,
there is not proprité like salefilename in openfile gielog

thanks

解决方案

Try:

Dim sfd As New SaveFileDialog()
If sfd.ShowDialog() = DialogResult.OK Then
    Dim filenameWithPath As String = sfd.FileName
    Dim justTheFilename As String = Path.GetFileName(filenameWithPath)
End If


There is property named FileName that could be set or get with the full file name (including the path).

Look on this MSDN Example[^]


这篇关于如何通过Savefiledialog获取文件名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆