开发者

How do you find out if a control is located on a tab control?

开发者 https://www.devze.com 2023-01-28 12:48 出处:网络
Hopefully this should be fairly easy, although after much searching I cant figure this out. How do you find out if a control is located on atab?

Hopefully this should be fairly easy, although after much searching I cant figure this out.

How do you find out if a control is located on a tab?

If ctl.ControlType <> 'Tab Controls' Then
.....
End if

The reason for doing this is that I have a piece of code that runs through the controls on a form, but runs into a problem when cycling through controls on a tab.

 If ctl.Parent.CurrentView <> 2 Then
            MsgBox ctl.Name
 End If

The above causes the error:

Error: 348 Object doesnt suppor开发者_JS百科t this property or method

Obviously it appears you cant refer to the current view of a tab control

Cheers for any advice any one has got out there

Noel


Check what ctl is before using CurrentView:

Select Case ctl.ControlType
    Case acCheckBox
        ' do something for check box
    Case acTabCtl
        ' do something for tab control
End Select
0

精彩评论

暂无评论...
验证码 换一张
取 消