查找文件路径 [英] Finding a Path of a file

查看:62
本文介绍了查找文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c#中使用openFileDialog.我正在尝试获取从openFileDialog中选择的文件的路径.

有人可以指出我的做法吗.

干杯

Dan

Hi, I am using openFileDialog in c#. I am trying to take the path of the file I have selected from the openFileDialog.

Can someone point me to how this is done pleaseeee.

Cheers

Dan

推荐答案

string path = System.IO.Path.GetDirectoryName(filename);


您的意思是
Do you mean
OpenFileDialog openFileDialog1 = new OpenFileDialog();

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
    string p = openFileDialog1.FileName;
}


这篇关于查找文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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