473,324 Members | 2,473 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,324 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 2028
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: 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...
1
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.