Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   Opening a text file by double clicking (http://www.go4expert.com/forums/text-file-double-clicking-t6540/)

Annorax 26Sep2007 04:36

Opening a text file by double clicking
 
Hi everyone,

I am writing a simple text editor. I would like the ability to be able to right click on a text file in my system and "Open With" using my program. Here is what I have so far:

Code:

If Environment.GetCommandLineArgs() Is Nothing Then
        'Make new file normally
Else
        'Open each file in Environment.GetCommandLineArgs() string array
End If

However, this yields in an error:

Exception System.NullReferenceException was thrown in debuggee:
Object reference not set to an instance of an object.

Is this the best approach at doing this? I don't want to associate it with my program, just open it. I also noticed that in the Windows "Open With" list, my icon is there but my program name is blank. Is there a way to set this?

Thanks for any help.

shabbir 26Sep2007 09:11

Re: Opening a text file by double clicking
 
I don't see any code in the above code block where it should have an exception and where do you get that exception.


All times are GMT +5.5. The time now is 13:02.