ArrayList作为属性类型 [英] ArrayList as a Property type
本文介绍了ArrayList作为属性类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这不行。我想New是需要的,但我不知道在哪里?
公共属性过滤器()如ArrayList
获取
Filters.Add(cboFilter.Text)
--- snip--
提前致谢任何信息
This doesn''t work. I guess New is needed someplace but I don''t know where?
Public Property Filters() As ArrayList
Get
Filters.Add(cboFilter.Text)
---snip--
Thanks in advance for any info
推荐答案
存储arraylist的本地副本以返回属性。
公共属性过滤为ArrayList
获取
Dim marFilters as New Arraylist
marFilters.Add(cboFilter.text)
返回marFilters
结束获取
Ken
--- --------------------
"只是我 <是ne ******** @ a-znet.com>在消息中写道
新闻:好的**************** @ tk2msftngp13.phx.gbl ...
这不是'不行。我想New是需要的,但我不知道在哪里?
公共属性过滤器()如ArrayList
获取
Filters.Add(cboFilter.Text)
--- snip--
提前致谢任何信息
Hi,
Store a local copy of the arraylist to return in the property.
Public Property Filters as ArrayList
Get
Dim marFilters as New Arraylist
marFilters.Add(cboFilter.text)
return marFilters
end get
Ken
-----------------------
" Just Me" <ne********@a-znet.com> wrote in message
news:Ok****************@tk2msftngp13.phx.gbl...
This doesn''t work. I guess New is needed someplace but I don''t know where?
Public Property Filters() As ArrayList
Get
Filters.Add(cboFilter.Text)
---snip--
Thanks in advance for any info
2004年8月10日
该物业没有维护一个ArrayList本身的实例。
你也有错误的属性的概念。你应该做什么
做的是创建一个ArrayList的页面级变量,然后创建一个
子,你调用它来添加一个过滤器。然后,如果你想检索
过滤器,
只是直接访问arraylist变量。这看起来像是:
dim过滤器作为新的ArrayList
Private Sub AddFilter()
filters.add (cbofilter.text)
End Sub
Private Sub Button1_Click(....)
如果过滤器(0)=
"东西"然后
....''用列表做点什么
结束子
属性由以下内容维护:
dim _userinput as string
公共属性UserInput()as String
获取
返回_userinput
结束获取
设置(字节值为字符串)
_userinput = value
结束集
结束物业
那么你可以使用这样的属性:Class.Userinput = Something。
我希望这是有意义的!祝你有个美好的一天!
Joseph MCP
" Just Me"写道:
August 10, 2004
The property does not maintain an instance of ArrayList itself.
You also have the concept of the property wrong. What you should
do is create a page level variable of ArrayList and then create a
sub that you call to add a filter. Then if you want to retrieve the
filters,
just access the arraylist variable directly. This looks something like:
dim filters as new ArrayList
Private Sub AddFilter()
filters.add(cbofilter.text)
End Sub
Private Sub Button1_Click(....)
if filters(0) = "Something" then
.... '' do something with list
End Sub
A property is maintained by something like this:
dim _userinput as string
Public Property UserInput() as String
Get
return _userinput
End Get
Set (byval value as string)
_userinput = value
End Set
End Property
Then you can use the property like this: Class.Userinput = Something.
I hope this makes sense! Have a good day!
Joseph MCP
"Just Me" wrote:
这不起作用。我想New需要在某个地方,但我不知道在哪里?
公共属性过滤器()如ArrayList
获取
Filters.Add (cboFilter.Text)
---剪辑 -
提前感谢您提供任何信息
This doesn''t work. I guess New is needed someplace but I don''t know where?
Public Property Filters() As ArrayList
Get
Filters.Add(cboFilter.Text)
---snip--
Thanks in advance for any info
2004年8月10日
在你的例子中,marFilters不会超出范围吗?
另外,要只有一个Get语句,属性声明
必须标记为ReadOnly。这看起来也很可疑......
一个函数......
Joseph MCP
" Ken Tucker [MVP]"写道:
August 10, 2004
Wouldn''t the marFilters go out of scope in your example?
Also, to only have a Get statement, the property declaration
must be marked as ReadOnly. That also looks suspiciously like
a function...
Joseph MCP
"Ken Tucker [MVP]" wrote:
存储arraylist的本地副本以返回属性。
公共属性过滤器作为ArrayList
获得
暗淡的marFilters作为新的Arraylist
marFilters.Add(cboFilter.text)
返回marFilters
结束获得
肯
-----------------------
"只是我 <是ne ******** @ a-znet.com>在消息中写道
新闻:好的**************** @ tk2msftngp13.phx.gbl ...
这不行。我想New需要在某个地方,但我不知道在哪里?
公共属性过滤器()如ArrayList
获取
Filters.Add (cboFilter.Text)
---剪辑 -
提前感谢您提供任何信息
Hi,
Store a local copy of the arraylist to return in the property.
Public Property Filters as ArrayList
Get
Dim marFilters as New Arraylist
marFilters.Add(cboFilter.text)
return marFilters
end get
Ken
-----------------------
" Just Me" <ne********@a-znet.com> wrote in message
news:Ok****************@tk2msftngp13.phx.gbl...
This doesn''t work. I guess New is needed someplace but I don''t know where?
Public Property Filters() As ArrayList
Get
Filters.Add(cboFilter.Text)
---snip--
Thanks in advance for any info
这篇关于ArrayList作为属性类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文