从自定义函数返回多个值 [英] Return Multiple Values from a Custom Function

查看:77
本文介绍了从自定义函数返回多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从自定义函数返回多个值?


TIA

How can I return multiple values from a custom function?

TIA

推荐答案

你可以或者用一堆属性创建一个对象 - 并设置

这些属性。

您还可以在函数中使用ByRef参数,并通过
返回值
设置这些参数 - 所以他们的功能消费者可以在功能完成后检查这些参数的

值。


" Nikolay彼得罗夫" <乔****** @ mail.bg>在消息中写道

news:e4 ************** @ TK2MSFTNGP11.phx.gbl ...
You can either create an object with a bunch of properties - and you set
those properties.
You can also have ByRef parameters in your function, and return values by
setting those parameters - so they consumer of your functin can check the
values of those parameters after the function is done.

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
我怎样才能返回多个来自自定义函数的值?

TIA
How can I return multiple values from a custom function?

TIA



返回结构


朋友MyFunction()为MyStructure


Dim ms为MyStructure

ms。< properties> =。 。 。 。


返回MyStructure


结束功能


-

OHM(特里伯恩斯)

。 。 。单手人。 。

" Nikolay Petrov" <乔****** @ mail.bg>在消息中写道

news:e4 ************** @ TK2MSFTNGP11.phx.gbl ...
Return a Structure

Friend MyFunction() as MyStructure

Dim ms as MyStructure

ms.<properties>= . . . .

Return MyStructure

End Function

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:e4**************@TK2MSFTNGP11.phx.gbl...
我怎样才能返回多个来自定制功能的价值?

TIA
How can I return multiple values from a custom function?

TIA



Hi Nikolay,


除了其他人之外,


首先要确保你需要一个返回值。


当它是关于一个对象你甚至可以使用一个子


Private Sub a(byval b as whateverObject)

end sub


是相同的


私有函数a(byval b as whateverObject)as whateverObject

返回b

结束函数


我希望这有帮助吗?


Cor
Hi Nikolay,

In addition to the others,

Be first sure that you needed a return value.

When it is about an object you can even use a sub

Private Sub a (byval b as whateverObject)
end sub

is the same as

Private Function a (byval b as whateverObject) as whateverObject
return b
end function

I hope this helps?

Cor


这篇关于从自定义函数返回多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆