For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > April 2005 > Find Control Type at Run-Time









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Find Control Type at Run-Time
Emma

2005-04-27, 8:55 pm

If I use UserControl.Controls to load the controls on a form into an array,
is there a way of determining the type of control based on any of the
information stored in the array? I want to look for all the date picker
controls in the array and make changes to their values. Is this possible,
even if I don’t know the names of the controls?

Thanks
Emma

Jeff Johnson [MVP: VB]

2005-04-27, 8:55 pm


"Emma" <Emma@discussions.microsoft.com> wrote in message
news:A1B4940C-A761-4765-8E22-CCC19F38C340@microsoft.com...

> If I use UserControl.Controls to load the controls on a form into an
> array,
> is there a way of determining the type of control based on any of the
> information stored in the array? I want to look for all the date picker
> controls in the array and make changes to their values. Is this possible,
> even if I don't know the names of the controls?


[Air code]

Dim c As Control

For Each c In UserControl.Controls
Debug.Print TypeName(c)
Next


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com