public partial class frmMain : Form { public string[] argparams; public frmMain() { argparams = Environment.GetCommandLineArgs(); InitializeComponent(); } private void frmMain_Load(object sender, EventArgs e) { string vplocation; string defaultvp = Application.StartupPath + "default.vp1"; try { if (argparams.Length > 1) { if (File.Exists(Application.StartupPath + argparams[1])) { vplocation = Application.StartupPath + argparams[1]; } else { //we couldnt find a default.vp1 or the file specified with args in our app.startuppath //last resort, check if the full path is specified if (File.Exists(argparams[1])) { vplocation = argparams[1]; } } } else { if (File.Exists(defaultvp)) { //if our default.vp1 exists, continue loading it vplocation = defaultvp; } } } catch (Exception errordata) { MessageBox.Show("an error occured" + errordata.Message, "Error"); } } public void vpScriptnotfound() { MessageBox.Show("No vpscript file found, or specified", "Error: VP terminated"); } }