开发者

How to return the full path of the SaveFileDialog?

开发者 https://www.devze.com 2023-03-11 17:29 出处:网络
How to get the full path string from a SaveFi开发者_C百科leDialog? SaveFileDialog.FileName only gives me the filename with extension. I have looked into SaveFileDialog on MSDN, but I don\'t see any pr

How to get the full path string from a SaveFi开发者_C百科leDialog? SaveFileDialog.FileName only gives me the filename with extension. I have looked into SaveFileDialog on MSDN, but I don't see any property does that.

I need to return "C:\Folder1\subFolder2\File004.sdf" not just "File004.sf"


"Gets or sets a string containing the full path of the file selected in a file dialog." is what the MSDN article you linked says for FileName property. Plus, FileName has always given me the full file path.


What I basically do is more or less

SaveFileDialog x = new SaveFileDialog();

if (x.ShowDialog() == DialogResult.OK)
{
    //Use here x.FileName
}

and it always returned the full path. Are you sure you don't see the absolute path?


I think you might be using the wrong dll - win32 instead of WinForms. Had the same issue today.


You must catch it after you press "Ok", not before.

0

精彩评论

暂无评论...
验证码 换一张
取 消