Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
Dim a
a = Forms("仓调拨单").Controls("Labels4")
If a IsNot Nothing Then
MessageBox.Show("活动窗口为:")
Else
MessageBox.Show("无活动窗口!" )
End If
运行该代码,提示找不到 Labels4控件。
如何才能屏蔽错误?
我窗口上就没有名为:Labels4的控件。
由于考虑到代码的通用性。
加入当前窗口中未存在某控件,则跳过某段代码。
Dim frm As WinForm.Form = Forms.ActiveForm
If frm IsNot Nothing Then
For Each c As WinForm.Control In Forms(frm.Name).Controls
Output.Show(c.Name)
Next
End If
判断上面代码中的C.Name就行了。