Results 1 to 2 of 2

Thread: open text files with my notepad...

  1. #1
    DeathStar13 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    May 2012
    Posts
    1
    Reputation
    0

    open text files with my notepad...

    hi everybody,
    i created my own notepad and it can open files with openFileDialog.
    but i also want that if i select a text file, and i say "open with" my notepad... that my notepad will show that text file...

    so not with openFileDialog or someting like that...

    Thanks!

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    11,333
    Reputation
    1543
    When you use Open With in Windows Explorer and select your program, it is equivalent to you opening a Command window and typing the path of your app followed by the path of the data file. In both cases, your app will be executed and the path of the data file will be passed as a commandline argument. You can process that commandline argument in one of two main ways:

    1. Handle the Startup event of the application (and StartupNextInstance for single-instance apps) and access the commandline arguments via the 'e' parameter.
    2. Call Environment.GetCommandLineArgs anywhere in your app, e.g. in the Load event handler of the main form.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking