Click here to Skip to main content
15,031,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
Good Day!!!

is there a way in which we can pass a class to an exe file?

Sample, i have a class Person

VB
Public Class Person
        Property Name As String
        Property Age As String
        Property Address As String
    End Class


in the exe file i would like to execute it as

addperson.exe person

or is there a possibility that i could convert the said class to a string and vice versa?

thank you in advance and hoping i would have a response from the masters out there.

What I have tried:

Had tried to convert the class to string but not successful.
Posted
Updated 24-Jul-17 4:28am
Comments
PIEBALDconsult 24-Jul-17 11:40am
   
myapp "<Person Name='Bob' Age='ancient' Address='Toronto' />"

You would need to pass a string - args() is a string array.

You could serialise the object to a file by some means, and then pass that filename as an argument and deserialise the object inside your software
   
Comments
SherMags 24-Jul-17 10:32am
   
thank you both.
Not as a single object - you can only pass strings as command line arguments.

You can pass all three strings as separate arguments by surrounding each with double quotes and separating them with spaces, or if you have control over the other application you could come up with a argument format that passes the three strings. For example, "string one|string two|string 3" as a single argument and then use Split to break it up at the other end.
   
Comments
SherMags 24-Jul-17 10:32am
   
Thank you both

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900