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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Trideep PatelProject 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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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
amdefactoCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.