Open a text file in notepad

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 2
Reputation: silverfire is an unknown quantity at this point 
Solved Threads: 0
silverfire silverfire is offline Offline
Newbie Poster

Open a text file in notepad

 
0
  #1
Jun 29th, 2007
Hi all, I'm building a simple logging program in VB5. I'm entirely self-taught using a couple books and the help files, so if I'm missing something obvious, that's probably why.

Anyway, I'm trying to get my program to be able to open old logs in notepad. I can't seem to to figure out how to do this. I've tried the Shell function, but that just opens notepad. When I try to specify my file instead of the program it gives me an error (Invalid procedure call or argument) which doesn't really surprise me.

I'm assuming I need to open notepad, and then tell it to open the file, I just don't know how and can't seem to figure it out..

Thanks!
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: Open a text file in notepad

 
0
  #2
Jun 29th, 2007
Try this

dim linne as string

linne = "notepad d:\test\testfile.txt"
shell linne


That should work (obviously replace my file and folder name with yours)

Denis
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 2
Reputation: silverfire is an unknown quantity at this point 
Solved Threads: 0
silverfire silverfire is offline Offline
Newbie Poster

Re: Open a text file in notepad

 
0
  #3
Jun 29th, 2007
Thanks! It worked. As soon as I saw it, I knew what I was missing. Now I have to see if I can replace notepad with the system defined text editor. Don't tell me how yet though, I want to ry to solve it on my own. It's amazing what I can learn by accident...
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: Open a text file in notepad

 
0
  #4
Jun 30th, 2007
Originally Posted by silverfire View Post
Thanks! It worked. As soon as I saw it, I knew what I was missing. Now I have to see if I can replace notepad with the system defined text editor. Don't tell me how yet though, I want to ry to solve it on my own. It's amazing what I can learn by accident...

Glad to hear it worked.

A little tip if I may (don't look if you don't want to) ....
























































Without using Shell command use the windows run command to test the line you are going to use e.g Notepad file.txt. If that works Shell will work most times. There are other fiddles I know if you get stuck.

Denis
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 5252 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC