One other option would be to define a Type for the return, e.g., if you
needed
Public Type Credentials
strUserName as String
strPassword as String
End Type
Public Function GetCredentials() as Credentials
...
End Function
Cheers,
-Roy
-----Original Message-----
From: Chris Tacke [mailto:ctacke@r...]
Sent: Thursday, September 13, 2001 9:16 AM
To: professional vb
Subject: [pro_vb] RE: How to get 2 values from a function???
A class has way more overhead than you probably need to return two integer
values.
> -----Original Message-----
> From: John Stendor [mailto:john.stendor@c...]
> Sent: Thursday, September 13, 2001 12:01 PM
> To: professional vb
> Subject: [pro_vb] RE: How to get 2 values from a function???
>
>
> Use a class as the return value. The class will inturn contain the
> properties you want to return.
>
> Chris Tacke wrote:
> >
> > Pass the variables byref (which is the default anyway) and just
> change them.
> >
> > Try this to get a feel for it:
> >
> > Public Sub Caller()
> > Dim i as integer
> > Dim j as integer
> >
> > i = 2
> > j = 3
> >
> > MsgBox "i=" & i & vbcrlf & "j=" & j
> >
> > Callee i, j
> >
> > MsgBox "i=" & i & vbcrlf & "j=" & j
> > End Sub
> >
> > Public sub Callee(ByRef var1 as integer, ByRef var2 As Integer)
> > var1 = var1 * 5
> > var2 = var 1 + 10
> > End Sub
> >
> > This code should give you 2 message boxes
> >
> > i=2
> > j=3
> >
> > followed by
> >
> > i=10
> > j
> >
> > -------------------------------
> > Christopher Tacke, MCSD
> > Associate, Rubicon Technologies
> > (xxx) xxx-xxxx ext 319
> >