Click here to Skip to main content
15,936,850 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to invoke one wpf application from another wpf application. The invoking wpf application makes the call
ProcessStartInfo BOM = new ProcessStartInfo();

BOM.FileName = @"D:\WPFAPPLICATION.exe";

BOM.Arguments = temp;


Now in the invoked application, I try to retrieve the argument passed using
string arguments =Process.GetCurrentProcess().StartInfo.Arguments;

However the arguments are not passed. why is this??

I also tried an alternative method where in:

public partial class App : Application
   public static String[] mArgs;

   private void Application_Startup(object sender, StartupEventArgs e)

       if (e.Args.Length > 0)
           mArgs = e.Args;


I have also tried:
string[] args = Environment.GetCommandLineArgs

However this did not work either!!! Please HELP!!
Updated 16-May-12 18:55pm
Member 10290238 11-Oct-13 22:56pm    
Process.Start("http://localhost:50613/IAlert%20Website/User/readmore.aspx?artid=id&usid=userid");is it correct?

1 solution

I found a web page that showed a version that was converted from C# to VB.Net[^]

Ive tried this in VB.Net and it works

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim psnfo As String
    Dim strbuilder As New StringBuilder
    Dim arg As String
    For Each arg In Environment.GetCommandLineArgs()
    psnfo = strbuilder.ToString
    TextBox1.Text = "Args: " & psnfo.ToString
End Sub

The code returns:
Args: C:\Testapp1.exe

It will return both args passed to it.

your code does not appear to treat the args as an array or group of items.
Hope this helps some.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900