Controls属性
适用范围
Form
描述
窗体上的控件数组。用于通过索引访问控件属性。
使用
GGet Form.Controls(Index As Integer).Property, var
GSet Form.Controls(Index As Integer).Property, value
- Form
- 指定窗体名称。
- Index
- 指定含有窗体上控件索引的整数表达式。
- Property
- 指定要访问的控件属性名称。
- var
- 指定要取得属性值的变量。数据类型取决于指定的属性。
- value
- 指定要在属性中设置的表达式。数据类型取决于指定的属性。
备注
使用Controls属性可通过索引访问窗体上的控件。这样便允许您循环访问控件集合并获取或设置一般属性。
另见
Count、Type
示例
Integer i, count
String type$
GGet frmMain.Controls.Count, count
For i = 1 To count
GGet frmMain.Controls(i).Type, type$
If type$ = "Button" Then
GSet frmMain.Controls(i).Enabled, False
EndIf
Next i
← ControlBox属性 Count属性 →