How do I pass a veriable into a VB.Net Application

Is it possible to pass variables from the commandline into a VB.Net Application. What I am looking to do is send emails using html format and give the user a hyperlink that will open a program I have already placed on their computer. The hyperlink need to tell the program what the Patient Number and Appointment Number is. I know this can be done in ASP.NET but what about VB.Net.

In ASP.NET it would look like this
http://server/findpatient.asp?AppointmentNumber=55325&PatientNumber=1234

Can this be done in VB.Net? Or is their another way to do this in VB.Net.
jamescorwinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
The call would look like this:

    YourAppName 55325 1234

Here is the code:

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private ApptNum As Integer
    Private PatNum As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim args() As String = Microsoft.VisualBasic.Command().Split(" ".ToCharArray)
        If args.GetUpperBound(0) >= 1 Then
            Try
                ApptNum = Integer.Parse(args(0))
                PatNum = Integer.Parse(args(1))
            Catch ex As Exception
                MsgBox("Invalid Appointment or Patient Number")
            End Try
        Else
            MsgBox("Insufficient Parameters")
        End If
        MsgBox("ApptNum = " & ApptNum.ToString & vbCrLf & _
            "PatNum = " & PatNum.ToString)
    End Sub
End Class
0
jamescorwinAuthor Commented:
I tried this but when I run the execute the program from the commandline as follows
C:\Program Files\SIPCA\InstallEmrInstall\EmrInteractive.exe 55325 1234
I get the following error

Cannot find file C:\Program Files\SIPCA\InstallEmrInstall\EmrInteractive.exe 55325 1234

If I take out the parameters it finds the file and gives the Message "Insufficient Parameters" as it should.
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
>> when I run the execute the program from the commandline as follows

What code are you using to do this?

~IM
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

jamescorwinAuthor Commented:
I'm not sure if your asking what code am I using in my program or how am I executing the program with parameters. So here is the answer to both.

I'm using the code you showed me in Visual Basic.Net ver 2003. Basically I cut and paste it in.

I'm calling the file by putting
C:\Program Files\SIPCA\InstallEmrInstall\EmrInteractive.exe 55325 1234
in the run box.

I'm also try to all it using <a href> in html within an email. The problem is that windows is not opening
C:\Program Files\SIPCA\InstallEmrInstall\EmrInteractive.exe
then passing 55325 1234 as parameter. Instead windows is trying to open
C:\Program Files\SIPCA\InstallEmrInstall\EmrInteractive.exe 55325 1234
as the whole file name which does not exist.

How should I open this file?
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Ok...I see.

I'm not sure if you can create an html link to a local exe that passes parameters in.

Will check it out...

~IM

0
jamescorwinAuthor Commented:
In what way will this code allow you to open it.
Is it supposed to work from the run box?
Is it only supposed to work from another windows application?
If I could understand how this code will work maybe I can move in that direction.
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
The code I provided traps parameters passed into the application, which is typically done from the DOS prompt or by Shelling fromm another application.

~IM
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Hi jamescorwin,

I have searched high and low for how to pass command-line parameters to an EXE from a URL and can't find a single solution.  I don't think it is possible.

Sorry,

~IM
0
jamescorwinAuthor Commented:
Thanks anyway... I have been searching as well and I can't find a way to do it either.
0
Bob LearnedCommented:
It is possible.  I got a new job recently, and they are doing this there, with no-touch deployment.

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jamescorwinAuthor Commented:
I do not think anyone is able to answer this question as it appears that it's not possible.
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Bob said its possible with "no-touch deployment".

Can you explain in a little more detail Bob?

;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.