子返回值 [英] Sub - return values
问题描述
我曾经使用的其他语言,你可以从
子程序/方法/函数中返回一个值。
除非我错过了一些基本的东西(没有双关语)你不能这样做
VB.NET
AFAICS我可以用C#来做,但不能用VB做,我没错?
-
PAul
Every other language I''ve worked in, you can return a value from a
subroutine/method/function.
Unless I''ve missed something basic (no pun intended) you can''t do that in
VB.NET
AFAICS I can do it in C#, but not in VB, am I right?
--
PAul
推荐答案
您可以使用vb.net返回值。您可以更改传递的变量
byref,当然还有函数返回值。以下是一些简单的例子。
私人函数ReturnPi()As Double
返回3.14
结束功能
Private Sub ChangeX(ByRef x As Integer)
x = x + 3
End Sub
Ken
---------------------
PAul Maskens <下午****** @ mvps.org>在消息中写道
新闻:英国************** @ TK2MSFTNGP09.phx.gbl ...
Hi,
You can return values with vb.net. You can change a variable passed
byref, and of course functions return values. Here are some simple examples.
Private Function ReturnPi() As Double
Return 3.14
End Function
Private Sub ChangeX(ByRef x As Integer)
x = x + 3
End Sub
Ken
---------------------
"PAul Maskens" <pm******@mvps.org> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
其他所有语言我都是已经工作了,你可以从
子程序/方法/函数中返回一个值。
除非我错过了一些基本的东西(没有双关语意)你不能在
VB.NET
AFAICS我可以用C#来做,但不能用VB做,我是对的吗?
-
PAul
Every other language I''ve worked in, you can return a value from a
subroutine/method/function.
Unless I''ve missed something basic (no pun intended) you can''t do that in
VB.NET
AFAICS I can do it in C#, but not in VB, am I right?
--
PAul
" PAul Maskens" <下午****** @ mvps.org> schrieb
"PAul Maskens" <pm******@mvps.org> schrieb
我曾经使用的其他语言,你可以从
子程序/方法/函数中返回一个值。
除非我错过了一些基本的东西(否)双关语你不能在VB.NET中这样做
AFAICS我可以用C#来做,但不能用VB做,我是对的吗?
Every other language I''ve worked in, you can return a value from a
subroutine/method/function.
Unless I''ve missed something basic (no pun intended) you can''t do
that in VB.NET
AFAICS I can do it in C#, but not in VB, am I right?
公共函数test()为整数
返回17
结束函数
http://msdn.microsoft.com/library/en...Procedures.asp
-
Armin
如何报价以及原因:
http://www.plig.net/nnq/nquote.html
< a rel =nofollowhref =http://www.netmeister.org/news/learn2quote.html\"target =_ blank> http://www.netmeister.org/news/learn2quote.html
public function test() as integer
return 17
end function
http://msdn.microsoft.com/library/en...Procedures.asp
--
Armin
How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
嗨Paul,
不,你错了。
在VB中你有没有返回值的Subs和其他语言相同
具有返回值的函数。
我希望这就是你在寻找的地方吗?
Cor
Hi Paul,
No you are wrong.
In VB you have Subs without return values and the same as in other language
Functions with return values.
I hope this was what you where looking for?
Cor
这篇关于子返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!