?
Solved

How can you do a variable argument list in visual basic 6?

Posted on 2008-10-16
3
Medium Priority
?
383 Views
Last Modified: 2010-10-05
In C you can declare a function like this

     int CombineArguments( int first, ... )

where the ellipses denote a variable argument list.

How can I do this in visual basic 6?

Tia,

- avi


0
Comment
Question by:progtw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Assisted Solution

by:FER_G
FER_G earned 160 total points
ID: 22731726
Tia,  avi;
Yes, in VB 6 you must use the PARAMARRAY word in the list of arguments; search in the msdn help file of vb
FerG
Saludos.
--
Ing. Fernando D. Giletta
San Fco. Cba. Argentina.
0
 
LVL 10

Assisted Solution

by:c0ldfyr3
c0ldfyr3 earned 160 total points
ID: 22731727
Like below, the only drawback is they have to be Variant.

Public Function CombineArguments(ParamArray vItem() As Variant) As Long
End Function

Open in new window

0
 
LVL 22

Accepted Solution

by:
danaseaman earned 180 total points
ID: 22731790
Try this:

Dim Res
Res = MyFunction("abc", 123, True, 4.5)

Private Function MyFunction(ParamArray args As Variant) 
   Dim i As Integer
 
   For i = LBound(args) To UBound(args)
      'do something
   Next i
End Function

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Suggested Courses

743 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