473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to recognize a Command Line parameter?

I am trying to send a command line parameter to a utilty I wrote. For
example:

c:\utilities\powerbuddy.exe 50

The 50 can be any number.

How do I see it in the program? Do I have to create a Main rountine and
pass it the value? If so how? And then, how do I load the main form of the
applicaiton from the Main sub?

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com
Nov 29 '06 #1
3 1146
"Anil Gupte" <an*******@icinema.comschrieb:
>I am trying to send a command line parameter to a utilty I wrote. For
example:

c:\utilities\powerbuddy.exe 50

The 50 can be any number.

How do I see it in the program? Do I have to create a Main rountine and
pass it the value? If so how? And then, how do I load the main form of
the applicaiton from the Main sub?
<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/95ee4737bce72df5>

Loading the form:

\\\
Application.Run(New MainForm())
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 29 '06 #2
I am getting No accessible 'Main' method with an appropriate signature was
found in 'PowerBuddy'.

Where do I put this:
Public Module Program

Public Sub Main(ByVal Arg As Integer)

End Sub

End Module

I right clicked on the solution and picked "Add Module". Then I added the
Sub Main and made the module Public. Still I am getting the abvoe error.

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:uS**************@TK2MSFTNGP02.phx.gbl...
"Anil Gupte" <an*******@icinema.comschrieb:
>>I am trying to send a command line parameter to a utilty I wrote. For
example:

c:\utilities\powerbuddy.exe 50

The 50 can be any number.

How do I see it in the program? Do I have to create a Main rountine and
pass it the value? If so how? And then, how do I load the main form of
the applicaiton from the Main sub?

<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/95ee4737bce72df5>

Loading the form:

\\\
Application.Run(New MainForm())
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 29 '06 #3
"Anil Gupte" <an*******@icinema.comschrieb:
>I am getting No accessible 'Main' method with an appropriate signature was
found in 'PowerBuddy'.

Where do I put this:
Public Module Program

Public Sub Main(ByVal Arg As Integer)
The 'Main' sub expects an array of strings as shown in my sample. You'll
have to perform your own conversion:

\\\
Public Sub Main(ByVal Args() As String)
Dim Number As Integer
If Args.Length 0 Then
Number = CInt(Args(0))
Else
...
End If
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Edvard Majakari | last post by:
Hi, I was wondering what would be the most elegant way for creating a Python class wrapper for a command line utility, which takes three types of arguments: 1. options with values (--foo=bar)...
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
5
by: jlea | last post by:
I'm trying to pass a filename, obtained with using the fileName property from the OpenFileDialog, as a application parameter in Process.StartInfo.Arguments and run a MFC/C++ application using the...
1
by: amirmira | last post by:
I would like to set command line arguments to a service at install time. I need to do this because I need to get information from different registry locations depending on my command line argument....
7
by: David A. Osborn | last post by:
I am current writing a console program that takes two file paths as command line input. I get the command line input using the following code: parameter = Split(Command()) input = parameter(0)...
2
by: Virgil | last post by:
Hello, I am attempting to create a small app that executes a stored procedure in SQLServer and have been unsuccessful in getting the procedure to execute from my application. The error received...
8
by: djc | last post by:
I'm new to this and was wondering what the options are for interpreting the command line using a CLI program. Specifically methods for interpreting the parameters passed to the program on the...
2
by: Mark B | last post by:
My gridview update command seems to always execute the first part of the SQL statement regardless of whether or not there is a value for the @AutoNumberID parameter. Any ideas? UpdateCommand="...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.