Referencing a Controls Siblings

When a VB form has multiple container controls, it is sometimes useful to quickly reference only the other controls in that container (what I call "siblings"). For example, clicking a checkbox contro

ITPro Today

February 18, 2002

1 Min Read
ITPro Today logo

When a VB form has multiple container controls, it is sometimes useful to quickly reference only the other controls in that container (what I call "siblings"). For example, clicking a checkbox control in a frame control may need to cause the other controls in the frame to become locked, while leaving the other controls on the form alone. This function returns a collection of all such "sibling" controls (based on the control that is passed in). You can then iterate over the returned collection of controls using For Each...Next. (Note that the function itself iterates over all the form's controls to determine which ones to include, so it's not a time-saver as much as a code-saver.)

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like