Phylum Posted July 21, 2003 Posted July 21, 2003 Can someone please provide some code to itterate through EVERY control in a form? I know how to do the basic one for each control in me.controls next but how do you handle container controls with controls inside of them? What about container controls inside of container controls? Is there a simple an easy way to do this? Phylum Quote
*Experts* Volte Posted July 21, 2003 *Experts* Posted July 21, 2003 If you wanted to set the text of all controls on a form, you'd do something like this: Private Function SetAllTextProperties(ByVal textVal As String, ByVal rootContainer As Control) Dim c As Control For Each c In rootContainer.Controls c.Text = textVal SetAllTextProperties(textVal, c) Next End Functionand use it likeSetAllTextProperties("test", Me)Remember that all controls have a controls collection (even if they aren't container controls), so you still check every control on the form for children. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.