Page 1 of 1

Open Notepad and put text with vb.net

Posted: Sat Mar 22, 2014 9:59 am
by jordy03
hello
Is there anyone who know a code to open app like notepad and automatically open a text file in it, also can it work for notepad ++ and how please

example code
Code: Select all
Dim path as string = "C:\file.txt"
process.start("notepad.exe", path)
(this doesnt work and i havent tested just saying that it kinda should look like this, ty

Re: Open Notepad and put text with vb.net

Posted: Sat Mar 22, 2014 11:06 am
by comathi
I'm not sure I understand what you mean. Do you mean automatically opening certain files with an app (file association) or launching an app through code that will open a file?

The code you posted above: in the case of Notepad, this will work, but programs may vary in the way they treat arguments passed to them on load.

Re: Open Notepad and put text with vb.net

Posted: Sat Mar 22, 2014 11:08 am
by Shim
Try this
Code: Select all
System.Diagnostics.Process.Start ("notepad.exe")

Re: Open Notepad and put text with vb.net

Posted: Sat Mar 22, 2014 11:12 am
by XTechVB
To open Notepad++ and load a file you can do this
Code: Select all
Process.Start("notepad++.exe", "FULL FILE PATH HERE")
Just tested it and it works fine.

Re: Open Notepad and put text with vb.net

Posted: Sat Mar 22, 2014 2:16 pm
by jordy03
ohh wait.. i've gave the write code thinking it was wrong,..
it actually worked .. thanks to all my bad