Controlling Certain Control Type

Glorinous

New member
Joined
Aug 14, 2013
Messages
2
Programming Experience
1-3
Hi

I have a form that contains labels and other controls. I want to change some properties of all the labels (only) on the form. Is that possible using the For Each statement or is there another way?

Thanks
 
Hi,

Yes, give this a try:-

VB.NET:
For Each currentLabel As Label In Me.Controls.OfType(Of Label)()
  MsgBox(currentLabel.Text)
Next

Hope that helps.

Cheers,

Ian

BTW, Welcome to the Forum.
 
Back
Top