Open with not working for vb made program

March 10, 2011 at 18:59:42
Specs: Windows 7
I created a tabbed notepad application using vb.net. When i right click on a txt file and choose "open with" and select my app, the app opens but the file does not open in the app. Is there something I must do to make this work? Inside the app when I go to File and then open, everything works great.

note:I did test the open with on a file that I know opens correctly.

TIA,

Tomm


See More: Open with not working for vb made program

Report •


#1
March 11, 2011 at 02:40:07
And? Did you ever code your application to handle Open With? If so, show the code.

EDIT: Read this: http://msdn.microsoft.com/en-us/lib...

How To Ask Questions The Smart Way


Report •

#2
March 11, 2011 at 10:23:33
I did not realize there was such code. I will look for an example, if you have one please share. Thanks.

Report •

#3
March 12, 2011 at 14:35:57
Ok, so after more reading its very simple. I do however believe I am doing something wrong. While the program works as intended, I think I made it harder than needed. When I used
strCommandLine = Command()
mynotepad.loadfile(strCommandLine)

my program would bomb stating illegal characters. It ended up being the quotes. I had to
Dim cuttstr As Integer
Dim extension As String
cuttstr = strCommandLine.Length
extension = strCommandLine.Remove((cuttstr - 1), 1)
extension = extension.Remove(0, 1)

Now, this works to cut the quotes off each end but I thought that I was probaly just making this harder than it really was. Is there a better way?


Report •

Related Solutions

#4
March 13, 2011 at 07:12:43
Does My.Application.CommandLineArgs strip the double quotes? It handles the drag/drop start method better than just Command. If not, I'd probably just use a call to String.Replace.

How To Ask Questions The Smart Way


Report •


Ask Question