473,800 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\po werbuddy.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 1160
"Anil Gupte" <an*******@icin ema.comschrieb:
>I am trying to send a command line parameter to a utilty I wrote. For
example:

c:\utilities\po werbuddy.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.d e/group/microsoft.publi c.dotnet.langua ges.vb/msg/95ee4737bce72df 5>

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******** ******@TK2MSFTN GP02.phx.gbl...
"Anil Gupte" <an*******@icin ema.comschrieb:
>>I am trying to send a command line parameter to a utilty I wrote. For
example:

c:\utilities\p owerbuddy.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.d e/group/microsoft.publi c.dotnet.langua ges.vb/msg/95ee4737bce72df 5>

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*******@icin ema.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
2782
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) 2. boolean options (--squibble) 3. data lines (MUNGE:x:y:z:frob)
10
26143
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 null references another, FK_LASTLYOID bigint not null references lastly, unique (FK_OTHEROID,FK_ANOTHEROID))
5
5833
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 Start method. When I hardcode the application parameter such as "/name=c:\\myFile.txt" all is well in the C++ application. When I use the fileName property to build the parameter, the string becomes @"/name=c:\myFile.txt" which makes the C++...
1
7904
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. I have to do it this way as the consumer of the service should not be able to change the argument - except by uninstalling and reinstalling the service. I created the service and the service itself works great. However, when I try to install...
7
6617
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) output = parameter(1) Unforunately this method does not handle embedded spaces in the file paths, for example C:\Documents and Settings\Administrator. Is there a simple way to handle this? From my command prompt experience I know that paths...
2
1019
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 when issuing the ExecuteNonQuery is "Procedure 'TestProc' expects parameter '@IN', which was not supplied.". Any help would be greatly appreciated. Below is a test stored proc and code.
8
1874
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 command line. I noticed that visual studio adds the following for you when creating a new CLI program: void main(string args) { }
2
1224
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=" IF @AutoNumberID IS NULL INSERT INTO dbo.tblLanguageValues(LanguageCode, LookupID, LanguageText) VALUES (@LanguageCode, @LookupID, @LanguageText) ELSE
0
9691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7580
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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 we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.