Solved

Can't make VB6 program that uses argv

Posted on 2011-09-15
4
425 Views
Last Modified: 2012-06-27
I'm trying to make a VB6 project that uses a main subroutine whose first line declares it as follows:  Sub Main(ByRef argv() As String)

I need to be able to pick up command line arguments, but I get error message "Must have startup form or Sub Main()."  When I elimiante the argv reference, the project compiles.  How do I fix this?
0
Comment
Question by:thomsone
  • 3
4 Comments
 
LVL 11

Accepted Solution

by:
kbirecki earned 500 total points
Comment Utility
Are you referring to command line arguments when you start the app?

You can pick those up using Command$, such as

Dim c as string
c = Command$

Then you can work with that string, either splitting by spaces, commas, whatever.
0
 
LVL 11

Expert Comment

by:kbirecki
Comment Utility
You don't put arguments in the Sub Main() proc that defines your startup.
0
 

Author Closing Comment

by:thomsone
Comment Utility
Thanks for the fast help!
0
 
LVL 11

Expert Comment

by:kbirecki
Comment Utility
Happy to help.  
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now