Solved

VB.Net application listen to command line variable

Posted on 2013-12-16
4
601 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now