VB新手 [英] New at VB
问题描述
我不确定这是不是正确的新闻组,但.......当某个属性程序中的get语句触发时,有人可以点击
我。
>
示例
属性姓氏为字符串
获取
LastName = mstrLastName
结束获取
设置(ByVal值为字符串)
mstrLastName =值
结束集
结束财产
当我在get语句中注释掉作业时,程序
仍然执行
帮助
Steve
Im not sure it this is the right newsgroup but.......can someone expain to
me when the get statement fires in a property procedure.
Example
Property lastname as string
Get
LastName=mstrLastName
End Get
Set(ByVal Value as String)
mstrLastName = Value
End Set
End Property
When i remark out the assignment within the get statement, the programs
still executes
Help
Steve
推荐答案
*" Stephen Martinelli" < ST ***** @ johnstontrading.com> scripsit:
* "Stephen Martinelli" <st*****@johnstontrading.com> scripsit:
我不确定这是正确的新闻组,但.......当某个get语句在属性过程中触发时,有人可以告诉我
。
示例
属性姓氏为字符串
获取
LastName = mstrLastName
结束获取
设置(ByVal值为字符串)
mstrLastName = Value <结束设置
结束属性
当我在get语句中注释掉作业时,程序仍然执行
Im not sure it this is the right newsgroup but.......can someone expain to
me when the get statement fires in a property procedure.
Example
Property lastname as string
Get
LastName=mstrLastName
End Get
Set(ByVal Value as String)
mstrLastName = Value
End Set
End Property
When i remark out the assignment within the get statement, the programs
still executes
获取物业价值时将调用''物业获取'':
\\\
Dim x As New Foo()
x.LastName =" Herfried" ''来电设定。
Dim s As String = x.LastName''Calls Get。
///
- -
Herfried K. Wagner
MVP·VB Classic,VB.NET
< http://www.mvps.org/dotnet> ;
The ''Property Get'' will be called when getting the property''s value:
\\\
Dim x As New Foo()
x.LastName = "Herfried" '' Calls Set.
Dim s As String = x.LastName '' Calls Get.
///
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
嗨Stephen,
获取并不是必须返回值。如果您没有指定,将返回其值类型的
默认值。
获取
LastName = mstrLastName
结束获取
实际上与
相同
获取
Dim LastName As String
LastName = mstrLastName
结束获取
但你不能评论昏暗,因为它''隐藏''
问候,
Fergus
Hi Stephen,
A Get isn''t obliged to return a value. If you don''t specify one, the
default for its value type will be returned.
Get
LastName = mstrLastName
End Get
is effectively the same as
Get
Dim LastName As String
LastName = mstrLastName
End Get
but you can''t comment out the Dim because it''s ''hidden''
Regards,
Fergus
* hi *************** @ gmx.at (Herfried K. Wagner [MVP])scripsit:
* hi***************@gmx.at (Herfried K. Wagner [MVP]) scripsit:
属性姓氏为字符串
获取
LastName = mstrLastName
Property lastname as string
Get
LastName=mstrLastName
上面的行没有意义。使用''返回mstrLastName''
代替。上面的代码将再次调用''属性集'。
-
Herfried K. Wagner
MVP· VB Classic,VB.NET
< http://www.mvps.org/dotnet>
The line above doesn''t make sense. Use ''Return mstrLastName''
instead. The code above will call the ''Property Set'' again.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
这篇关于VB新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!