|
-
Jun 7th, 2000, 10:09 PM
#1
Thread Starter
Member
Hi,
I have some code and the way this has been written , the reciving function takes in 3 variables as parameters , but only passes back the information into a new variable
e.g
runc = callgeo( lat,lon, map)
I am sending variable :- lat, lon, map to function 'callgeo'
and receiving this into a variable runc.
Can I not just receive the information back as 3 separate variables, or what is the best way to approach this in vb.
-
Jun 7th, 2000, 10:30 PM
#2
Hyperactive Member
A FUNCTION returns a value in a single variable. Try SUB.
Try making the new variables that you want lat,lon & map assigned to PUBLIC and re-assign the new values in the Sub like so:
Call callgeo(lat,lon,map)
Public Sub callgeo(lat,lon,map)
{
Your code here for whatever calculations. Then Re-assign the new values of lat,lon & map to your new variables before you exit the sub and they will be updated.
newvar1 = lat
newvar2 = lon
newvar3 = map
}
Now newvar1, 2 and 3 will be available throughout the program in 3 seperate variables.
Hope it helps...
-
Jun 7th, 2000, 10:35 PM
#3
PowerPoster
You couls also make an UDT to send the values back and let the parameter variables as they are:
Code:
'Module
Type tVars
x as Long
y as Long
z as Long
End Type
'Anywhere
Function CallGeo(iLat, iLon, iMap) as tVars
CallGeo.x = 324
CallGeo.y = 35
CallGeo.z = 465
End Function
'Code
Dim Temp as tVars
Temp = CallGeo( 1, 2, 3 )
MsgBox "Returns: " & Temp.x & ". " & Temp.y & "." & temp.z
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
|