Solved

VB.Net application listen to command line variable

Posted on 2013-12-16
4
620 Views
Last Modified: 2014-01-13
I have a need to pass a variable from a commandline parameter to a vb.net form in VB.  I have no clue on how to set the vb.net form so that it is actively listening so that when the variable is pass, it would capture what value is pass to the form.

Anyone have any examples or can point me to a website?  Tried googling, but can't seem to find anything.  

An example, would be creating a bat file that pass any value (a parameter) and the form can pop up with a messagebox, indicating what was pass to the form.  The vb.net form will need to be actively open and listening.  When the bat file is run, it will ask for a value, user enter the value and then that value is pass to the form.  Form will pop up with a messagebox indicating what value is pass.
0
Comment
Question by:holemania
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 250 total points
ID: 39721817
I don't think you can do this exactly as you've outlined.  Your argument needs to be passed when the executable is launched.
However, there may be other ways of accomplishing this.  One method would be to use the filesystemwatcher; when the batch file is run, it passes that variable onto a predescribed filename/extension.  When the trigger for the file creation hits, it could popup the data contained within that file.

See an example here: http://www.techrepublic.com/article/use-the-net-filesystemwatcher-object-to-monitor-directory-changes-in-c/
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
ID: 39724535
You can make a single instance application and then handle the StartupNextInstance event to accept the new argument passed in

http://msdn.microsoft.com/en-us/library/b9z4eyh8(v=vs.90).aspx
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39755014
Still on holidays?
0
 

Author Closing Comment

by:holemania
ID: 39777909
Thanks for the information.  Looking at the example, might be something that I can use.  Due to year end, I am tied up, but will focus once I'm back.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question