Display Text in notepad ?

haseebhm

Member
Joined
Jan 12, 2009
Messages
9
Programming Experience
3-5
I want to display a string (stored in a variable) in notepad(or any other default text editor depending upon the system). Saving to a text file is not necessary. I just want to open Notepad with an unsaved file containing the text. Please help
 
what do you mean by open it in notepad, do you want to open the file or do something like type what ever is in the text file into a textbox or something
 
VB.NET:
My.Computer.Clipboard.SetText(variablename)
Then just go to notepad (or any text editor) and click paste.
 
well i have text in a string variable or say a textbox.
i want to show that text in notepad with an untitled file.(i don't want to save that to a file and then open that file in notepad)
and i would not use the clipboard method because that would erase whatever the user already had in the clipboard.
 
The easiest ways have already been explained, saving to a temp file, using the clipboards etc... To get more detailed then that, you have to get into using API to find the proper window handles and set text to that handle. This can be done but doing a quick search Ive seen you have been asking the same question on other message boards for months now and have gotten the same answers including full API examples. Your complaint there was about displaying data to multiple versions of notepad all without saving. Of course without saving there is no difference in the notepad name/title to specify which window handle to use.

Personally I dont understand the need for this in the first place. If the data is already displayed in your custom program why do you even need to display the same data in notepad? Since the answer has already been given to you, I wouldnt waste any more time providing examples without a clear understanding of it all.
 
Back
Top