473,238 Members | 3,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

Notepad

Hi All,

I did use the block of code below to open a notepad, However, I would like
to insert some data which I did collect in the runtime into the notepad
before it show. How can I do it? Any help is greatly appreciated. Thanks you
very much in advance...

Kate
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();

System.Diagnostics.ProcessStartInfo pcInfo = new
System.Diagnostics.ProcessStartInfo( "Notepad.exe" );

pcInfo.UseShellExecute = false;

pcInfo.RedirectStandardOutput = true;

myProcess.StartInfo = pcInfo;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();
Jan 10 '06 #1
6 2025
cql90,

What I would do is create a temporary file and then pass the path of
that file to the command line. Notepad should open it up and display the
contents.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"cql90" <cq***@yahoo.com> wrote in message
news:u3**************@TK2MSFTNGP14.phx.gbl...
Hi All,

I did use the block of code below to open a notepad, However, I would like
to insert some data which I did collect in the runtime into the notepad
before it show. How can I do it? Any help is greatly appreciated. Thanks
you very much in advance...

Kate
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();

System.Diagnostics.ProcessStartInfo pcInfo = new
System.Diagnostics.ProcessStartInfo( "Notepad.exe" );

pcInfo.UseShellExecute = false;

pcInfo.RedirectStandardOutput = true;

myProcess.StartInfo = pcInfo;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();

Jan 10 '06 #2
RSH


I use this code to create an error string during processing and if it's
length is greater than 1 then I know it contains data and I write it to a
textfile. The user is then alerted and asked if they want to view the
errors. If they answer yes Notepad is spawned with the txt file that was
written a couple lines above it.

if (strError.Length > 1)

{

String strFilename = AppDomain.CurrentDomain.BaseDirectory +
"DataImportErrorLog-" + ".txt";

TextWriter tw = new StreamWriter(strFilename);

tw.WriteLine(strError);

tw.Close();

DialogResult result = MessageBox.Show("Errors occurred during the data
transfer. Would you like to view the Error Log now?", "Confirm",
MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

if (result == DialogResult.OK)

{

Process.Start("Notepad.exe", strFilename);

}

}

"cql90" <cq***@yahoo.com> wrote in message
news:u3**************@TK2MSFTNGP14.phx.gbl...
Hi All,

I did use the block of code below to open a notepad, However, I would like
to insert some data which I did collect in the runtime into the notepad
before it show. How can I do it? Any help is greatly appreciated. Thanks
you very much in advance...

Kate
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();

System.Diagnostics.ProcessStartInfo pcInfo = new
System.Diagnostics.ProcessStartInfo( "Notepad.exe" );

pcInfo.UseShellExecute = false;

pcInfo.RedirectStandardOutput = true;

myProcess.StartInfo = pcInfo;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();

Jan 10 '06 #3
Hi,

What if you create a temp text file and pass it as a parameter?
You can use Path.GetTempfilename()

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"cql90" <cq***@yahoo.com> wrote in message
news:u3**************@TK2MSFTNGP14.phx.gbl...
Hi All,

I did use the block of code below to open a notepad, However, I would like
to insert some data which I did collect in the runtime into the notepad
before it show. How can I do it? Any help is greatly appreciated. Thanks
you very much in advance...

Kate
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();

System.Diagnostics.ProcessStartInfo pcInfo = new
System.Diagnostics.ProcessStartInfo( "Notepad.exe" );

pcInfo.UseShellExecute = false;

pcInfo.RedirectStandardOutput = true;

myProcess.StartInfo = pcInfo;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();

Jan 10 '06 #4
Wonderful help from all of you, I am deeply appreciated. The data which I
did collect in the runtime base on User's action, therefore I would like to
send it directly to the notepad, so I can save a lot of round trip.
Otherwise, I have to create a file, write data to the file and then pass the
file name to ProcessStartInfo. Any ways, you guys are awesome. Thanks you
is not a good word for me to say. Take care and have a nice day...

Kate,
"cql90" <cq***@yahoo.com> wrote in message
news:u3**************@TK2MSFTNGP14.phx.gbl...
Hi All,

I did use the block of code below to open a notepad, However, I would like
to insert some data which I did collect in the runtime into the notepad
before it show. How can I do it? Any help is greatly appreciated. Thanks
you very much in advance...

Kate
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();

System.Diagnostics.ProcessStartInfo pcInfo = new
System.Diagnostics.ProcessStartInfo( "Notepad.exe" );

pcInfo.UseShellExecute = false;

pcInfo.RedirectStandardOutput = true;

myProcess.StartInfo = pcInfo;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();

Jan 10 '06 #5
On Tue, 10 Jan 2006 11:50:51 -0800, "cql90" <cq***@yahoo.com> wrote:
Hi All,

I did use the block of code below to open a notepad, However, I would like
to insert some data which I did collect in the runtime into the notepad
before it show. How can I do it? Any help is greatly appreciated. Thanks you
very much in advance...

Kate
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();

System.Diagnostics.ProcessStartInfo pcInfo = new
System.Diagnostics.ProcessStartInfo( "Notepad.exe" );

pcInfo.UseShellExecute = false;

pcInfo.RedirectStandardOutput = true;

myProcess.StartInfo = pcInfo;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();


An alternative suggestion. Notepad is so simple it is reasonably easy
to create an equivalent text viewing form that you can load text into
from within your application, basically just a form with a menu bar
and a big multiline text box. There may even be something similar
lying around already.

rossum

--

The ultimate truth is that there is no ultimate truth
Jan 10 '06 #6
Another helpful from Rossum, I am greatly appreciated. Take care and have a
good day...

"rossum" <ro******@coldmail.com> wrote in message
news:ij********************************@4ax.com...
On Tue, 10 Jan 2006 11:50:51 -08
00, "cql90" <cq***@yahoo.com> wrote:
Hi All,

I did use the block of code below to open a notepad, However, I would like
to insert some data which I did collect in the runtime into the notepad
before it show. How can I do it? Any help is greatly appreciated. Thanks
you
very much in advance...

Kate
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();

System.Diagnostics.ProcessStartInfo pcInfo = new
System.Diagnostics.ProcessStartInfo( "Notepad.exe" );

pcInfo.UseShellExecute = false;

pcInfo.RedirectStandardOutput = true;

myProcess.StartInfo = pcInfo;

myProcess.Start();

myProcess.WaitForExit();

myProcess.Close();


An alternative suggestion. Notepad is so simple it is reasonably easy
to create an equivalent text viewing form that you can load text into
from within your application, basically just a form with a menu bar
and a big multiline text box. There may even be something similar
lying around already.

rossum

--

The ultimate truth is that there is no ultimate truth

Jan 11 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: aa | last post by:
I write to a text file, and when view the resulting file in Notepad, it shows "\t" as tabs correctly, but "\n" does not break the line. Instad it shows as a square. In Dreamweaver it shows OK....
1
by: Roger | last post by:
I've got some MS-windows (XP only?) related questions; hopefully someone can give me some advise. 1) Is there some way to make notepad to become the front window when it is started from within...
4
by: Jesper | last post by:
How can I open a textfile from C# using notepad (or the user assigned application for this).
1
by: jj | last post by:
How do I programatically default the encoding of my "Notepad" into ANSI. My application uses notepad to save some text. Some of the client computers have UTF as the default encoding in their...
9
by: Sandy | last post by:
can mfc application, send text data to opened notepad file in desktop?(live transfer of data) . can anybody help
3
by: RN Das | last post by:
Hi expert, I have a small web application in C# and ASP.Net and I want to open a file in notepad when clicked on a linked button. Here is hander code when clicked on the link button. It can open...
2
by: andreas | last post by:
hi, In windows xp in the start launch menu when i put notepad "c:\test.txt" i get notepad with test.txt in it. in vb.net when i state system.diagnostics.process.start("notepad.exe" i get...
7
by: kisshug | last post by:
hi i'm working on project.in that i have 2 call notepad.exe. i want to know how to call notepad.exe from a c program in unix environment -- kisshug Message posted via ...
9
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have this code for sendKeys. This simply sends a text to the notepad. This method runs fine, but I don't see the notepad and the text entered in that notepad. Is there any way...
36
by: Don | last post by:
I wrote an app that alerts a user who attempts to open a file that the file is currently in use. It works fine except when the file is opened by Notepad. If a text file is opened, most computers...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.