473,473 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Passing data from one VB.Net application to another

I have two applications, one of which can launch the other using a
System.Diagnostics.Process. I want to pass database connection
information from one application to the other. I've resorted to
creating an INI on the fly (that contains the connection information)
when the first app attempts to launch the second app. That file is
deleted immediately after the second app starts and grabs the data it
needs. Though this works pretty well I'm not comfortable with the
fact the information is out there (if even for a short time) and, if
the deletion ever fails, it could be out there until it is overwritten.

Does anyone have any ideas of how I can execute this more cleanly or
direct me to a good resource?

Thanks in advance for any help you can give me.

Sep 20 '06 #1
6 11522
You can either use standard windows messages although the support in
..net for this is not realy native and it is a bit limitted.

The recomended way to do this is using remotting which I found rather
complicated to get to grips with. It is very powerful once you get it
working. If you google .net, vb and remoting then you will find loads
of information on this. You can also look at msdn for information on
how to get remoting working.

Try this codeproject example, it is in C# so hopefully you are a
bi-lingual .net programmer.

http://www.codeproject.com/csharp/Net_Remoting.asp

A word of warning with remoting is that when you get onto events they
are allot more complicated than they first appear.

NYGeekGirl wrote:
I have two applications, one of which can launch the other using a
System.Diagnostics.Process. I want to pass database connection
information from one application to the other. I've resorted to
creating an INI on the fly (that contains the connection information)
when the first app attempts to launch the second app. That file is
deleted immediately after the second app starts and grabs the data it
needs. Though this works pretty well I'm not comfortable with the
fact the information is out there (if even for a short time) and, if
the deletion ever fails, it could be out there until it is overwritten.

Does anyone have any ideas of how I can execute this more cleanly or
direct me to a good resource?

Thanks in advance for any help you can give me.
Sep 20 '06 #2
NYGeekGirl,

One option would be to pass the connection information to the second app
using the Process object's StartInfo property:

Dim myProcess As New Process

myProcess.StartInfo.FileName = "App2.exe"
myProcess.StartInfo.Arguments = "My command line argument"
myProcess.Start()

The second app could then read its command line arguments and use the
information to get a database connection, etc.

There are several ways to read the command line arguments. You could use
Visual Basic's built-in Command function. Or, if you are using VB 2005, you
could use My.Application.CommandLineArgs.

Kerry Moorman
"NYGeekGirl" wrote:
I have two applications, one of which can launch the other using a
System.Diagnostics.Process. I want to pass database connection
information from one application to the other. I've resorted to
creating an INI on the fly (that contains the connection information)
when the first app attempts to launch the second app. That file is
deleted immediately after the second app starts and grabs the data it
needs. Though this works pretty well I'm not comfortable with the
fact the information is out there (if even for a short time) and, if
the deletion ever fails, it could be out there until it is overwritten.

Does anyone have any ideas of how I can execute this more cleanly or
direct me to a good resource?

Thanks in advance for any help you can give me.

Sep 20 '06 #3
I like this meathod ( arguments ) vs the UDP example I gave you.

M.

"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:76**********************************@microsof t.com...
NYGeekGirl,

One option would be to pass the connection information to the second app
using the Process object's StartInfo property:

Dim myProcess As New Process

myProcess.StartInfo.FileName = "App2.exe"
myProcess.StartInfo.Arguments = "My command line argument"
myProcess.Start()

The second app could then read its command line arguments and use the
information to get a database connection, etc.

There are several ways to read the command line arguments. You could use
Visual Basic's built-in Command function. Or, if you are using VB 2005,
you
could use My.Application.CommandLineArgs.

Kerry Moorman
"NYGeekGirl" wrote:
>I have two applications, one of which can launch the other using a
System.Diagnostics.Process. I want to pass database connection
information from one application to the other. I've resorted to
creating an INI on the fly (that contains the connection information)
when the first app attempts to launch the second app. That file is
deleted immediately after the second app starts and grabs the data it
needs. Though this works pretty well I'm not comfortable with the
fact the information is out there (if even for a short time) and, if
the deletion ever fails, it could be out there until it is overwritten.

Does anyone have any ideas of how I can execute this more cleanly or
direct me to a good resource?

Thanks in advance for any help you can give me.


Sep 20 '06 #4
I used UDP connection to pass some info from one to the other.

Dont know if this would be useful. It worked for me, for what I needed to
pass.

http://www.codeproject.com/vb/net/UDP_Send_Receive.asp
Great example....

I created a program and when the program runs it opend a thread to
constantly listen on a port.
The other program, checks processes, and if its running it sends the value
into the first program.

Miro

"NYGeekGirl" <me******@hotmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
>I have two applications, one of which can launch the other using a
System.Diagnostics.Process. I want to pass database connection
information from one application to the other. I've resorted to
creating an INI on the fly (that contains the connection information)
when the first app attempts to launch the second app. That file is
deleted immediately after the second app starts and grabs the data it
needs. Though this works pretty well I'm not comfortable with the
fact the information is out there (if even for a short time) and, if
the deletion ever fails, it could be out there until it is overwritten.

Does anyone have any ideas of how I can execute this more cleanly or
direct me to a good resource?

Thanks in advance for any help you can give me.

Sep 20 '06 #5
Thanks to everyone for their ideas. The command line argument worked
just fine.

Miro wrote:
I used UDP connection to pass some info from one to the other.

Dont know if this would be useful. It worked for me, for what I needed to
pass.

http://www.codeproject.com/vb/net/UDP_Send_Receive.asp
Great example....

I created a program and when the program runs it opend a thread to
constantly listen on a port.
The other program, checks processes, and if its running it sends the value
into the first program.

Miro

"NYGeekGirl" <me******@hotmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
I have two applications, one of which can launch the other using a
System.Diagnostics.Process. I want to pass database connection
information from one application to the other. I've resorted to
creating an INI on the fly (that contains the connection information)
when the first app attempts to launch the second app. That file is
deleted immediately after the second app starts and grabs the data it
needs. Though this works pretty well I'm not comfortable with the
fact the information is out there (if even for a short time) and, if
the deletion ever fails, it could be out there until it is overwritten.

Does anyone have any ideas of how I can execute this more cleanly or
direct me to a good resource?

Thanks in advance for any help you can give me.
Sep 20 '06 #6
You can either use standard windows messages although the support in
.net for this is not realy native and it is a bit limitted.
I think this option may be a bit overkill. Since she wanted to just pass
the message on app launch. Your solution would be necessary if you wanted
to pass messages around between running instances. The command line args
would work fine in the OP's situation. Otherwise, yours is a good alternative.
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Sep 21 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rob Oliver | last post by:
Hi, I've seen a walkthrough for passing data from a setup project to a custom action (an application) with an InstallClass. I am curious though--can the data also be intercepted by a custom...
10
by: vbMark | last post by:
Hello, I am doing this: window.location="page2.php?subj="+subj+"&body="+body; to send information to another page. However, I don't want that second page to show up or display in any way....
3
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
1
by: Jim Heimer | last post by:
How can I pass data from one child form to another? I have two forms, one (formX) that holds a datagrid (with the results of a query) and another (formY) that consists of many textboxes. I'd like...
3
by: Brian Smith | last post by:
I have a .aspx page (we'll call it Form1) with a datagrid on it. The datagrid is populated from a dataset that I manually entered data into (the data isn't in a database). The datagrid on Form1...
3
by: Evan | last post by:
I have a web page with 2 frames. The left frame is running menu.aspx and the right frame is running images.aspx. When a selection is made in menu.aspx I call a method in images.aspx and pass a...
3
by: Marc Castrechini | last post by:
First off this is a great reference for passing data between the Data Access and Business Layers:...
10
by: Vik | last post by:
From a Web page, I need to open another page created in another project and pass some object (a database connetion) to that page. Looks like the second project has its own Application and Session...
2
by: mrjoka | last post by:
hi guys, i'm building a web site where i have a lot of pages, in the default page i'm having a menu in this menu i have a callendar a drop down list, in the callendar i need to remember the date...
4
by: moondaddy | last post by:
I have a htm page where I need to pass some data to an aspx page as a means of sending data to the database. I don't need to see the aspx page so I was going to put it in a hidden iframe. This...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.