Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB.Net application listen to command line variable

Posted on 2013-12-16
4
Medium Priority
?
628 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 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