Information on command line arguments and more fun stuff.

  • Thread starter Thread starter Ryan Chavez
  • Start date Start date
R

Ryan Chavez

Hello, I'm looking for information on handling command line arguments in my VB.NET (2003) application. What I have is an application that loads up a specific file type. What I want is when I double click the file icon it will launch the application and load up the information. Basically the same functionality as say Microsoft Word does when you double click on files of .doc type. Also is it possible in VB.NET to have just one instance of an application running?

If anybody knows a good resource for learning how to do this, it will be greatly appreciated.

Thank you.
Ryan
 
Hi,

Comand Line Args
http://msdn.microsoft.com/library/d...emenvironmentclassgetcommandlineargstopic.asp

Single Instance
http://www.windowsformsdatagridhelp.info/default.aspx

Associate File type with program
http://msdn.microsoft.com/library/d...tingdocumenttypesassociatedfileextensions.asp

Ken
-------------------
Hello, I'm looking for information on handling command line arguments in my
VB.NET (2003) application. What I have is an application that loads up a
specific file type. What I want is when I double click the file icon it will
launch the application and load up the information. Basically the same
functionality as say Microsoft Word does when you double click on files of
..doc type. Also is it possible in VB.NET to have just one instance of an
application running?

If anybody knows a good resource for learning how to do this, it will be
greatly appreciated.

Thank you.
Ryan
 
Ryan Chavez said:
What I want is when I double click the file icon it will launch the
application
and load up the information. Basically the same functionality as say
Microsoft Word does when you double click on files of .doc type.

Add this code to a module file and select 'Sub Main' as startup object in
the project properties:

\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
For Each Arg As String In Args
Console.WriteLine(Arg)
Next Arg
End Function
End Module
///
Also is it possible in VB.NET to have just one instance of an application
running?

Single instance:

<URL:http://www.yoda.arachsys.com/csharp/faq/#one.application.instance>

File associations:

<URL:http://www.mentalis.org/soft/class.qpx?id=5>
 
Wow! Thanks for the links they are extreamly helpful. I had no clue what a
mutex is but I'll have to look into it.
Very much appreciated, thank you.

Ryan
 
Again thanks for the helpful links. I like Ken's recommendation of using the
Environment.GetCommandLineArgs() static function over the specified Sub Main
that you had. Although, depending on how I work out things I may use that
one instead. Also thank you for the wonderful yoda link. It had a lot of
good information there and a few questions that I've always wondered were
found there as well.
Again very much appreciated. Thank you.

Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top