Opening certain files with C#

I've set up a simple program that reads and prints .txt files in a richtextbox, but the purpose of it is to open a .log file (mirc log). a .log has the exact same structure as a .txt, so basicly how would I go about changing the filetype so my program could open this .log, or converted .txt


Answer this question

Opening certain files with C#

  • fishandchips

    Hi,

    If you are using the System.IO.StreamReader class then just passing the path to the .txt file or .log file will work. You do need to change the filetype.

    If you mean you want to register the filetype with your .EXE so that it opens when you double-click on it then see the following link:
    1. File Associations
    2. Programmatically Creating File Associations [Code sample is in VB.NET, let me know if you need help converting it to C#]

    Regards,
    Vikram



  • BanyiX

    Hrm... I did try that, and I thought it didn't work, but it did this time... thanks man.
  • Opening certain files with C#