Open Notepad and put text with vb.net

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
jordy03
New Member
New Member
Posts: 21
Joined: Thu Mar 06, 2014 6:09 pm

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
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

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.
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

Try this
Code: Select all
System.Diagnostics.Process.Start ("notepad.exe")
Find my programs on Softpedia
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

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.
You can find me on Facebook or on Skype mihai_92b
User avatar
jordy03
New Member
New Member
Posts: 21
Joined: Thu Mar 06, 2014 6:09 pm

ohh wait.. i've gave the write code thinking it was wrong,..
it actually worked .. thanks to all my bad
5 posts Page 1 of 1
Return to “Coding Help & Support”