Solved

VB.Net application listen to command line variable

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

17 Experts available now in Live!

Get 1:1 Help Now