Hi,
I have been looking for this quite some time now. I want
to be able to pass along a string of data into my
compiled programs, like prog.exe "myvar1" "myvar2" etc.
or prog.exe /f whatever /g whatever.
Anny ideas? Is this at all possible? If not, i think i
should really quit VB :( This is like the 20th thing i
wanna be able to do but can't do in vb.net :-/ 6 1473
Do you have the help file that comes with VS.NET?
Here is the sample right from the help
Function Main(ByVal CmdArgs() As String) As Integer
Dim ArgNum As Integer ' Index of individual command-line argument.
If CmdArgs.Length > 0 Then ' See if there are any arguments.
For ArgNum = 0 To UBound(CmdArgs)
' Examine CmdArgs(ArgNum) for settings you need to handle.
Next ArgNum
End If
MsgBox("Hello World!") ' Display message on computer screen.
Return 0 ' Zero usually means successful completion.
End Function
"CMG" <vb****@divx-warez.nl> wrote in message
news:06****************************@phx.gbl... Hi,
I have been looking for this quite some time now. I want to be able to pass along a string of data into my compiled programs, like prog.exe "myvar1" "myvar2" etc. or prog.exe /f whatever /g whatever.
Anny ideas? Is this at all possible? If not, i think i should really quit VB :( This is like the 20th thing i wanna be able to do but can't do in vb.net :-/
I don't know what to say...actually i do:
1st: i am so sorry, seems like the one place i didn't
think to find help was in the help file, tried MSDN (hard
to find annything there, but there are a few topics that
are good), google (found about 10 million pages, cus i
did not know how to name it actually, so i could not do a
specific search), tried www.planet-source-code.com (bout
90% is crap, but there are also verry, verry good things
there).
2nd: Thank you verry, verry much for pointing this out to
me and actually showing it to me.
3rd: Thank you!
4th: Did i say thank you?
and 5th: In case i forget: THANK YOU! -----Original Message----- Do you have the help file that comes with VS.NET?
Here is the sample right from the help
Function Main(ByVal CmdArgs() As String) As Integer Dim ArgNum As Integer ' Index of individual command-
line argument. If CmdArgs.Length > 0 Then ' See if there are any
arguments. For ArgNum = 0 To UBound(CmdArgs) ' Examine CmdArgs(ArgNum) for settings you need
to handle. Next ArgNum End If MsgBox("Hello World!") ' Display message on
computer screen. Return 0 ' Zero usually means successful completion. End Function
"CMG" <vb****@divx-warez.nl> wrote in message news:06****************************@phx.gbl... Hi,
I have been looking for this quite some time now. I
want to be able to pass along a string of data into my compiled programs, like prog.exe "myvar1" "myvar2" etc. or prog.exe /f whatever /g whatever.
Anny ideas? Is this at all possible? If not, i think i should really quit VB :( This is like the 20th thing i wanna be able to do but can't do in vb.net :-/
.
I get NO Accessable Main Method with an apropriate
signature was found... -----Original Message----- I don't know what to say...actually i do:
1st: i am so sorry, seems like the one place i didn't think to find help was in the help file, tried MSDN
(hardto find annything there, but there are a few topics that are good), google (found about 10 million pages, cus i did not know how to name it actually, so i could not do
aspecific search), tried www.planet-source-code.com (bout 90% is crap, but there are also verry, verry good things there).
2nd: Thank you verry, verry much for pointing this out
tome and actually showing it to me.
3rd: Thank you!
4th: Did i say thank you?
and 5th: In case i forget: THANK YOU!-----Original Message----- Do you have the help file that comes with VS.NET?
Here is the sample right from the help
Function Main(ByVal CmdArgs() As String) As Integer Dim ArgNum As Integer ' Index of individual
command-line argument. If CmdArgs.Length > 0 Then ' See if there are anyarguments. For ArgNum = 0 To UBound(CmdArgs) ' Examine CmdArgs(ArgNum) for settings you
needto handle. Next ArgNum End If MsgBox("Hello World!") ' Display message on computer screen. Return 0 ' Zero usually means successful
completion.End Function
"CMG" <vb****@divx-warez.nl> wrote in message news:06****************************@phx.gbl... Hi,
I have been looking for this quite some time now. I want to be able to pass along a string of data into my compiled programs, like prog.exe "myvar1" "myvar2"
etc. or prog.exe /f whatever /g whatever.
Anny ideas? Is this at all possible? If not, i think i should really quit VB :( This is like the 20th thing i wanna be able to do but can't do in vb.net :-/
. .
In article <00****************************@phx.gbl>, CMG wrote: I get NO Accessable Main Method with an apropriate signature was found...
If you put this in a form... It should be:
Public Shared Sub Main(ByVal Args() As String)
End Sub
Alternatively, it can be a function if you want to return an exit code
to the OS:
Public Shared Function Main(ByVal Args() As String) As Integer
....
Return 0
End Function
Or, you can do this using the System.Environment class, and skip the
main if you like:
Dim Args() As String = System.Environment.GetCommandLineArgs()
For Each Arg As String In Args
MessageBox.Show(Arg)
Next
Or, you can get it as one unparsed string:
MessageBox.Show(System.Environment.CommandLine)
HTH
--
Tom Shelton
MVP [Visual Basic]
CMG
If you take the function below and place it in it's own module say "Start"
then in the project properties under \Common Properties\General make the
Startup Object equal "Start", you should not have a problem.
Dan
"CMG" <vb****@divx-warez.nl> wrote in message
news:00****************************@phx.gbl... I get NO Accessable Main Method with an apropriate signature was found...-----Original Message----- I don't know what to say...actually i do:
1st: i am so sorry, seems like the one place i didn't think to find help was in the help file, tried MSDN (hardto find annything there, but there are a few topics that are good), google (found about 10 million pages, cus i did not know how to name it actually, so i could not do aspecific search), tried www.planet-source-code.com (bout 90% is crap, but there are also verry, verry good things there).
2nd: Thank you verry, verry much for pointing this out tome and actually showing it to me.
3rd: Thank you!
4th: Did i say thank you?
and 5th: In case i forget: THANK YOU!-----Original Message----- Do you have the help file that comes with VS.NET?
Here is the sample right from the help
Function Main(ByVal CmdArgs() As String) As Integer Dim ArgNum As Integer ' Index of individual command-line argument. If CmdArgs.Length > 0 Then ' See if there are any arguments. For ArgNum = 0 To UBound(CmdArgs) ' Examine CmdArgs(ArgNum) for settings you needto handle. Next ArgNum End If MsgBox("Hello World!") ' Display message on computer screen. Return 0 ' Zero usually means successful completion.End Function
"CMG" <vb****@divx-warez.nl> wrote in message news:06****************************@phx.gbl... Hi,
I have been looking for this quite some time now. I want to be able to pass along a string of data into my compiled programs, like prog.exe "myvar1" "myvar2" etc. or prog.exe /f whatever /g whatever.
Anny ideas? Is this at all possible? If not, i think i should really quit VB :( This is like the 20th thing i wanna be able to do but can't do in vb.net :-/
. .
Thank you so much for awnsering this whithout turning me
into flame bait :)
The truth is, i learned most of this on my own, and have
recently started a self study VB.NET, and actually just
never, ever did something with sub main... I tested it,
and it works like i thought, so i'm verry happy one of
the things i wanted now finally works :)
Now all i have to do is see how i could add my program to
the rightclick event of my mouse when the file extention
is .sfv, or that my program get's opened when i open
a .sfv file, and that the full path get's passed along to
the main executable.
So: THANK YOU! :) -----Original Message----- In article <00****************************@phx.gbl>, CMG
wrote: I get NO Accessable Main Method with an apropriate signature was found...
If you put this in a form... It should be:
Public Shared Sub Main(ByVal Args() As String) End Sub
Alternatively, it can be a function if you want to
return an exit codeto the OS:
Public Shared Function Main(ByVal Args() As String) As
Integer .... Return 0 End Function
Or, you can do this using the System.Environment class,
and skip themain if you like:
Dim Args() As String =
System.Environment.GetCommandLineArgs() For Each Arg As String In Args MessageBox.Show(Arg) Next
Or, you can get it as one unparsed string:
MessageBox.Show(System.Environment.CommandLine)
HTH -- Tom Shelton MVP [Visual Basic] . This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve M |
last post by:
I'm trying to invoke a Java command-line program from my Python program
on Windows XP. I cannot get the paths in one of the arguments to work
right.
The instructions for the program describe the...
|
by: Edd Dawson |
last post by:
Hi. I have a strange problem involving the passing of command line
arguments to a C program I'm writing. I tried posting this in
comp.programming yesterday but someone kindly suggested that I'd...
|
by: SunRise |
last post by:
Hi
I am creating a C Program , to extract
only-Printable-characters from a file ( any type of file) and display
them.
OS: Windows-XP
Ple help me to fix the Errors & Warnings and explain...
|
by: paul |
last post by:
I have a file type that is going to be associated with my
visual basic application and i want the user to be able
to double click on a file of said type and have it launch
the program and load the...
|
by: Juan Romero |
last post by:
Hey guys,
I need to launch an external application, but I need to launch it with some
command line arguments. Now the thing is that I need to launch it as a
process. For example:
Dim p As New...
| |
by: Roland |
last post by:
Hi,
I am developing a C++ project and want to pass some command line
arguments in VS .NET 2003. I am in debug mode, the configuration is set
to Debug and I entered my argument list in Project ->...
|
by: mackmelo |
last post by:
Hi,
I'm trying to create a program that reads these two characters (& and
^) as arguments to a funcion. However since they are part of the
operational system characters with special funcions...
|
by: raphfrk |
last post by:
I have a program which reads in 3 filenames from the command line
prog filename1 filename2 filename3
However, it doesn't work when one of the filenames has spaces in it
(due to a directory...
|
by: Jwe |
last post by:
Hi,
I've written a program which has both a command line interface
and Windows form interface, however it isn't quite working
correctly.
When run from command line with no arguments it should...
|
by: neha_chhatre |
last post by:
please let me know
if am using command line arguments, how to send arguments to a C
program if i am working on ubuntu
say for example
suppose name of my program is prog.c
if argc=3
then how...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |