使用VB.Net 2005在记事本中打开文本文件 [英] Open a Text File in Notepad using VB.Net 2005

查看:383
本文介绍了使用VB.Net 2005在记事本中打开文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有什么似乎这么简单的事情但我无法弄清楚

如何做到这一点。


我正在使用一个streamwriter来构建一个文本文件。在

过程结束时,我想在记事本中打开相同的文本文件,这样用户就可以看看是什么内容。


我不能为我的生活弄明白如何在屏幕上的记事本中打开文本文件

。我尝试的所有进程再次将

文件打开到文件流中。


***通过Developersdex发送 http://www.developersdex.com ***


I have what seems to be such a simple thing yet I cannot figure out how
to do it.

I am using a streamwriter to build a text file. At the end of the
process I want to open that same text file in notepad so the user can
see what was built.

I cannot for the life of me figure out how to get the text file to open
up in notepad on the screen. All the processes I have tried opens the
file into the filestream again.

*** Sent via Developersdex http://www.developersdex.com ***

推荐答案

System.Diagnostics.Process.Start(" notepad.exe"," mydocument.txt")


" Chris Johnson" < CJ ****** @ cskauto.com>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ...
System.Diagnostics.Process.Start("notepad.exe", "mydocument.txt")

"Chris Johnson" <cj******@cskauto.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...

我有一个看似简单的事情,但我无法弄清楚如何做到这一点。

我正在使用一个编写器来构建一个文本文件。在
过程结束时,我想在记事本中打开相同的文本文件,这样用户就可以看看是什么构建的。

我不能为我的生活弄清楚如何在屏幕上的记事本中打开文本文件
。我尝试过的所有进程再次将
文件打开到文件流中。

***通过Developersdex发送 http://www.developersdex.com ***



> System.Diagnostics.Process.Start(" notepad.exe"," mydocument.txt")


这是正确的,它始终在记事本中打开文件。由于我们很多人使用不同的程序作为默认编辑器,所以最好自动打开相关应用程序中的文件
。这更容易:


System.Diagnostics.Process.Start(" mydocument.txt")

-

Peter Macej

Helixoft - http://www.vbdocman.com

VBdocman - VB,VB技术文档的自动生成器

..NET和ASP .NET代码
> System.Diagnostics.Process.Start("notepad.exe", "mydocument.txt")

This is correct and it always opens the file in Notepad. As many of us
use different program as default editor, it is better to automatically
open the file in associated application. That''s even easier:

System.Diagnostics.Process.Start("mydocument.txt")
--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
..NET and ASP .NET code


嗨Peter,

这也是我想做的事情。我想在文件名中包含

程序安装路径并尝试:

System.Diagnostics.Process.Start(Application.Start upPath& " \ filename.pdf")

但这不起作用我必须使用:


System.Diagnostics.Process.Start (C:\Program

Files\Myprograms\Program\filename.pdf)


工作正常。


有没有办法包含程序路径,因为程序可以在不同的位置安装



-

干杯

Chas


***************

*频谱为绿色*

***************

Peter Macej写道:
Hi Peter,
This was something that I also wanted to do. I would like to include the
program installation path in the file name and tried:

System.Diagnostics.Process.Start(Application.Start upPath & "\filename.pdf")

But this did not work I have to use:

System.Diagnostics.Process.Start("C:\Program
Files\Myprograms\Program\filename.pdf")

which works OK.

Is there a way to include the program path as the program could be installed
in a different location?
--
Cheers
Chas

***************
* Spectrum is Green *
***************
"Peter Macej" wrote:
System.Diagnostics.Process.Start(" notepad.exe"," mydocument.txt")
System.Diagnostics.Process.Start("notepad.exe", "mydocument.txt")



这是正确的,它总是在记事本中打开文件。由于我们很多人使用不同的程序作为默认编辑器,最好自动打开相关应用程序中的文件。这更容易:

System.Diagnostics.Process.Start(" mydocument.txt")

-
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - 自动发电机VB,VB的技术文档
.. NET和ASP .NET代码



This is correct and it always opens the file in Notepad. As many of us
use different program as default editor, it is better to automatically
open the file in associated application. That''s even easier:

System.Diagnostics.Process.Start("mydocument.txt")
--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
..NET and ASP .NET code



这篇关于使用VB.Net 2005在记事本中打开文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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