|
-
August 25th, 2001, 05:10 AM
#1
VB Procedures
Is it possible to return two different values for a VB procedure.If so please send me a sample procedure code.
-
August 25th, 2001, 02:24 PM
#2
Re: VB Procedures
you can use "ByRef"
Sub Return2Values(byval a as Integer, byval b as Integer, byref ret1 as Integer, byref ret2 as Integer)
ret1 = a * b
ret2 = a \ b
End Sub
private Sub Form_Load()
Dim a as Integer
Dim b as Integer
Return2Values 5, 2, a, b
MsgBox a & " " & b
End Sub
----------
The @host is everywhere!
----------
-
August 27th, 2001, 02:50 AM
#3
Re: VB Procedures
Another way:
private function somevalues(byval inP1 as integer, byval inP2 as integer) as variant
inp1 = inp1+1
inp2= inp2+1
somevalues= array(inp1,inp2)
end function
private sub form_load()
dim p1 as integer, p2 as integer
dim retval
retval = somevalues(p1,p2)
msgbox retval(0) & " " & retval(1)
end sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|