>For Each lblControl As Control In Me.Form.Controls > If TypeOf lblControl Is Label Then > ' Do something > End If >Next >Here is what I use:
' Loop through all the controls on the page and apply the business logic ' expO1 Control ' expC1 Alias Public Function PageControlRecursiveLoop(ByVal toControl As Object, ByVal tcAlias As String) As Boolean Dim lcKey As String = "" Dim lcID As String = "" Dim lcMessage As String = "" Dim loControl As System.Web.UI.Control Dim loControlButton As System.Web.UI.WebControls.Button Dim loControlImage As System.Web.UI.WebControls.Image Dim loControlImageMap As System.Web.UI.WebControls.ImageMap Dim loControlLabel As System.Web.UI.WebControls.Label ' Label values For Each loControl In toControl.Controls ' Label If TypeOf loControl Is System.Web.UI.WebControls.Label Then loControlLabel = CType(loControl, System.Web.UI.WebControls.Label)