ListCount属性

适用范围
ListBox、ComboBox

描述
设置并获取列表框或组合框中的项目计数

使用

GGet Form.Control.ListCount, var  
GSet  Form.Control.ListCount, value  
Form
指定窗体名称或含有窗体名称的字符串变量。
Control
指定控件名称或含有控件名称的字符串。控件必须位于指定窗体内。
var
取得属性值的整数变量。
value
指定要在属性中设置的整数表达式。

数值
返回列表中的项目数量。

备注
将ListCount设置为“0”,可以删除ListBox和ComboBox中的项目。如果将ListCount设置为超过列表中项目数量的值,则会将多出的项目添加到空白文本中。

另见
ComboBox、ListBox、AddItem、List

示例

Integer count  
' 获取列表中的项目数量  
GGet frmMain.lstPartNames.ListCount, count  
  
' 删除列表中的项目  
GSet frmMain.lstPartName.ListCount, 0