Why doesn't the yellow button do what its supposed to do? Is my do, while statement incorrect? The blue and red work. Help! Thank you.
VB Code:
Private Sub BlueButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BlueButton.Click Dim objControl As Control For Each objcontrol In Controls If TypeOf objcontrol Is Label Then objControl.BackColor = BackColor.Blue End If Next objControl End Sub Private Sub YellowButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles YellowButton.Click Dim objControl As Control Do While TypeOf objControl Is Label objControl.BackColor = BackColor.Yellow Loop End Sub Private Sub RedButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RedButton.Click Dim LabelCollection As New Collection() Dim objControl As Control For Each objControl In Controls If TypeOf objControl Is Label Then LabelCollection.Add(objControl) End If Next objControl For Each objControl In LabelCollection objControl.BackColor = BackColor.Red Next objControl End Sub




Reply With Quote