如何在c#按钮上打开任何文件 [英] How to open any file on button click in c#

查看:145
本文介绍了如何在c#按钮上打开任何文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生



请帮助我



我们如何打开像.doc这样的文件, .txt,.pdf和图像也是在使用c#单击按钮时。这些文件存储在文件中,这些路径存储在sql表中

Dear Sir

Please Help Me

how we can open any file like .doc, .txt, .pdf and image also when click on button using c#. That files are store in file and these path are store in sql table

推荐答案

尝试:

Try:
string file = @"D:\Temp\MyFile.pdf";
Process.Start(file);

系统将使用注册的任何应用程序来处理客户端PC上的文档类型以尝试打开它。

The system will use whatever app is registered to handle the document type on the client PC to try and open it.


这篇关于如何在c#按钮上打开任何文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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