System.Windows.Forms.OpenFileD ... [英] System.Windows.Forms.OpenFileD...

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

问题描述

按下按钮后,它会点击下面的代码:

 System.Windows.Forms.OpenFileDialog openFileDialog1 =  new  System.Windows.Forms.OpenFileDialog(); 
openFileDialog1.Title = 请选择一个文件;
openFileDialog1.InitialDirectory = C:temp;
openFileDialog1.ShowDialog();



但是openFileDialog1.ShowDialog();不起作用。弹出没有新窗口,调试就在那里停止。可能的原因是什么?谢谢,如果你可以分享你的经验。

解决方案

嗯......它可能确实有效。

它只是... ASP.NET暗示这是一个Web系统(正如您需要显式的System.Windows.Forms参考)。所以这将在服务器上打开一个对话框......如果可以的话。你的客户根本看不到它......



当然,当我将你的代码复制并粘贴到WinForms应用程序中时,它可以正常工作。


我应该使用FileUpload控件,因为它是ASP.Net应用程序。感谢。

After a button click, it hits the code below:

System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
openFileDialog1.Title = "Please Select a File";
openFileDialog1.InitialDirectory = "C:temp";
openFileDialog1.ShowDialog();


But openFileDialog1.ShowDialog(); does not work. No new window pops out and the debugging stops there. What's the possible reason? Thanks if you can share your experience.

解决方案

Well...it probably does work, in fact.
It's just...ASP.NET implies this is a web system (as does you need for an explicit System.Windows.Forms reference). So this will open a dialog...on the server, if it can. Your client won't see it at all...

Certainly, when I copy and paste your code into a WinForms application it works fine.


I should use FileUpload control since it is ASP.Net application. Thanks.


这篇关于System.Windows.Forms.OpenFileD ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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