We help IT Professionals succeed at work.

CustomControl property tabstop

sasot
sasot asked
on
Hi!

I would like to change tehe TabStop property of user control from within control itself, like:

Property Let Locked(b As Boolean)
  Text1.locked = b
  Me.TabStob= not b
End Property

However the second line does not work (unknown property).

I've already found a way around

Public sub Locked(b as boolean, cnt as control)
  Text1.locked = b
  cnt.TabStob= not b
End Sub

It works if I call this froma a form like

UserControl1.Locked True, UserControl1

but I do not like it this way. It is not elegant to pass
an argument UserControl1 each time I want to change the property.

Any ideas?

sasot







Comment
Watch Question

Head of Software Services
BRONZE EXPERT
Commented:
sasot, please stop using the refresh button on your browser. This duplicates your post and there are now a number of these entries. Instead click on the reload question link at the top right of the page.

You can use this code to determine which control in the container is actually the current user control and set the tabstop property (and any other this way).

    For Each Control In UserControl.ParentControls
        If Control.Name = UserControl.Ambient.DisplayName Then
            Control.TabStop = b
            Exit For
        End If
    Next

Author

Commented:
TimCotee

Sorry for refresh button. I did not know. However lately I am not notified of an answer via e-mail.

Regarding your answer. I faund a solution myself, it is
extender.tabstop =b


However your answer is very useful for me in other parts of my program, so I tahnk you for it.

Saso

Explore More ContentExplore courses, solutions, and other research materials related to this topic.