Solved

VB.Net application listen to command line variable

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
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…

813 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

16 Experts available now in Live!

Get 1:1 Help Now