Opening a text file by double clicking

Annorax's Avatar, Join Date: Nov 2006
Newbie Member
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:

If Environment.GetCommandLineArgs() Is Nothing Then
	'Make new file normally
	'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's Avatar, Join Date: Jul 2004
Go4Expert Founder
I don't see any code in the above code block where it should have an exception and where do you get that exception.