1、用TypeOf <对象实例> is <对象类型>操作符 2、用Typename(<对象实例>)函数
我知道。但是好象没用啊。假如我要把所有窗体的菜单都禁止掉,该怎么判断呢,我是这样来用的: Dim ctl As Control For Each ctl In FrmMain.Controls If (TypeOf Control Is Menu) Then Control.Enabled = False End If Next ctl但是就是禁止不掉。该怎么办啊,大哥,救我!
Dim ctl As Control For Each ctl In FrmMain '把.Controls去掉啊 If (TypeOf Control Is Menu) Then Control.Enabled = False End If Next ctl
给你看我的代码,就是随手画了一个窗体,添了一个按钮和几个菜单项Private Sub Command1_Click() Dim Ctl As Control For Each Ctl In Controls If TypeOf Ctl Is Menu Then Ctl.Enabled = False End If Next Ctl End Sub
2、用Typename(<对象实例>)函数
Dim ctl As Control
For Each ctl In FrmMain.Controls
If (TypeOf Control Is Menu) Then
Control.Enabled = False
End If
Next ctl但是就是禁止不掉。该怎么办啊,大哥,救我!
For Each ctl In FrmMain '把.Controls去掉啊
If (TypeOf Control Is Menu) Then
Control.Enabled = False
End If
Next ctl
Dim Ctl As Control
For Each Ctl In Controls
If TypeOf Ctl Is Menu Then
Ctl.Enabled = False
End If
Next Ctl
End Sub