Solved

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

Posted on 2008-10-16
3
381 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 40 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 40 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 45 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

My experience with Windows 10 over a one year period and suggestions for smooth operation
Outlook Free & Paid Tools
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

696 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