OPening existing program with VB.net and passng parameters

I have written a VB.net program. I now want write a second program that I need to be able to open from the 1st but be able to pass a variable from the 1st program to the second.

how do i do this?
LVL 1
ict-torquilclarkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
planoczCommented:
Why do you need to have  two interfaces? Whats the differents in one and the other?
depending on what you are trying to do may be MDI with Child forms would be better.
0
 
Trideep PatelConnect With a Mentor Project LeadCommented:
You can pass command line argument to the first exe from second one
Like

Start first exe from second with cmd line argument as following

 Dim p As New Process()
                ObjProcess = System.Diagnostics.Process.Start(first.exe, Var1& "|" & Var2 & "|" & Var3)
             

Read command line arguments in first application as
 If Command() <> Nothing Then 'Check command line arguments
                Dim s() As String = Command.Split("|") 'Split commaand using | sign
             
Here i split it with "|"
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
ict-torquilclarkAuthor Commented:
I am using two different programs because it is a fairly large program and so it means it splits the system resource requirements over two processes.

If i use process.start can I pass a parameter?
0
 
amdefactoConnect With a Mentor Commented:
This is how you can Pass the Parameter - refer to the example code.

http://msdn.microsoft.com/en-us/library/h6ak8zt5.aspx
0
 
Trideep PatelProject LeadCommented:
Yes, you can pass parameters in process.start

like i did i pass var1, var2 & var3 as command line argument

ObjProcess = System.Diagnostics.Process.Start(first.exe, Var1& "|" & Var2 & "|" & Var3)
0
 
Mohamed AbowardaSoftware EngineerCommented:
There are several ways to do this,

1. You may store data in the registry and the use System.Diagnostics.Process.Start to start your other program, when the other program start you can read data from registry and then clear it.

2. Store data into external file and use the same way as in the first way to read it.

3. Use (Command line argument) and this is the best way for small data, start your other program using System.Diagnostics.Process.Start(first.exe, Var1 & ";" & Var2 & ";" & Var3), In the other program use the the function Command() to read this variables, you can use split() function to split data so you can read each variable for ex: Command.Split(";")(0) this is the first variable (passed from your first application), also Command.Split(";")(1), this is the second variable etc...
0
All Courses

From novice to tech pro — start learning today.