RE: open from dskop
From: JWhitted (jason_whitted[at]hotmail[dot]com)
Date: 11/10/04
- Next message: Glenn Olshefsky: "Re: Outlook 2003 through VB.NET"
- Previous message: msdn_at_comsquared.com: "Basic PropertyGrid Cut, Copy, & Paste Question"
- In reply to: Pascal Cloup: "open from dskop"
- Next in thread: Pascal Cloup: "Re: open from dskop"
- Reply: Pascal Cloup: "Re: open from dskop"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 10 Nov 2004 08:52:02 -0800
When you double click an "associated" file, it passes the path of the
associated file to the associated program as an argument. You have to handle
this argument in your application.
An example would look like:
using System;
using System.IO;
using System.Windows.Forms;
public class Form1 : System.Windows.Forms.Form
{
public Form1(string[] args)
{
if(args.Length>0 && File.Exists(args[0]))
{
MessageBox.Show(String.Format("TODO: Implement code to open the
'{0}' file.", args[0]);
}
}
public static void Main(string[] args)
{
Application.Run(new Form1(args));
}
}
In the VS.NET IDE, you can "pass" command line arguments to the application
by doing the following:
Open up the Project's Properties Dialog Box. In the "Configuration
Properties" section, select "Debugging". In the "Start Options" section,
specify the desired file's path in the "Command Line Arguments" section.
Hope that helps.
-- Jason Whitted
- Next message: Glenn Olshefsky: "Re: Outlook 2003 through VB.NET"
- Previous message: msdn_at_comsquared.com: "Basic PropertyGrid Cut, Copy, & Paste Question"
- In reply to: Pascal Cloup: "open from dskop"
- Next in thread: Pascal Cloup: "Re: open from dskop"
- Reply: Pascal Cloup: "Re: open from dskop"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|