check = True Exit Function here: check = FalseEnd Function 然后就可以用if check(1) then unload 控件数组(1)了
'判断数组控件是否存在 Private Function IsExist(ByVal ControlName As String, ByVal Index As Integer) As Boolean Dim c As Control
For Each c In Controls If c.Name = ControlName Then If c.Index = Index Then IsExist = True Exit Function End If End If Next c IsExist = False End Function'if isexist("label",i) then unload label(i)
我用 Set lblHbl = Controls.Add("VB.label", "lblhbl" & Trim(Str(i))) 生成了i个标签。我应该卸载lblHbl呢,还是分别卸载lblhbl0,lblhbl1...等?
我在过程中使用以下方式,动态产生控件 Set lblHbl = Controls.Add("VB.label", "lblhbl" & Trim(Str(0))) 我需要在其他过程中卸载该控件,如何实现?
Dim c As Control
For Each c In Controls If left(c.Name,6) = "lblhbl" Then controls.remove c.name End If Next c
On Error GoTo here
控件数组名(nIndex).Tag = ""
check = True
Exit Function
here:
check = FalseEnd Function
然后就可以用if check(1) then unload 控件数组(1)了
Private Function IsExist(ByVal ControlName As String, ByVal Index As Integer) As Boolean
Dim c As Control
For Each c In Controls
If c.Name = ControlName Then
If c.Index = Index Then
IsExist = True
Exit Function
End If
End If
Next c
IsExist = False
End Function'if isexist("label",i) then unload label(i)
Set lblHbl = Controls.Add("VB.label", "lblhbl" & Trim(Str(i)))
生成了i个标签。我应该卸载lblHbl呢,还是分别卸载lblhbl0,lblhbl1...等?
Set lblHbl = Controls.Add("VB.label", "lblhbl" & Trim(Str(0)))
我需要在其他过程中卸载该控件,如何实现?
For Each c In Controls
If left(c.Name,6) = "lblhbl" Then
controls.remove c.name
End If
Next c