从c#代码打印记事本文本? [英] Print Notepad text from c# code?
本文介绍了从c#代码打印记事本文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行我的程序时它给了我错误:
没有应用程序与此操作的指定文件相关联
代码是:
when i run my program it gives me error:
No application is associated with the specified file for this operation
code is:
Process p = null;
try
{
p = new Process();
p.StartInfo.FileName = "C:\\Test.txt";
p.StartInfo.Verb = "Print";
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.UseShellExecute = true;
p.Start();
p.WaitForExit();
}
catch
{
MessageBox.Show(e.ToString());
}
plz有人帮我
plz some one help me
推荐答案
请阅读谢尔盖的评论并且不要使用记事本。
请按照以下链接查找带有示例的解决方案:
代码:打印文本文件(Visual C#) [ ^ ]
在C#中打印文本文件 [ ^ ]
Please, read Sergey''s comment and don''t do it using Notepad.
Follow these links to find solution with examples:
Code: Printing a Text File (Visual C#)[^]
Printing Text File in C#[^]
这篇关于从c#代码打印记事本文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文