try
{
OpenFileDialog dialog = new OpenFileDialog();
String appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string tempPath = System.IO.Path.GetTempPath();
dialog.InitialDirectory = tempPath;
dialog.Multiselect = true;
dialog.Filter = "Temp files (*.tmp)|*.tmp";
dialog.ValidateNames = false;
if (dialog.ShowDialog() == DialogResult.OK)
{
string[] filePaths = dialog.SafeFileNames;
foreach (string s in filePaths)
richTextBox1.Text += s;
//MessageBox.Show("");
}
}
catch
{
MessageBox.Show("Error Occured");
}
当我选择文件(这已经在其他应用程序中使用)在打开文件对话框会提示错误,但仍我想他们的道路......打开文件对话框错误选择用的文件
你确定你不打开它们吗? – CharlesB
我不想打开它们,只是我想要它们的路径... @CharlesB –
OFN_SHAREAWARE选项。你不能使用.NET包装器来设置。 –