Link to home
Start Free TrialLog in
Avatar of bbanis2k
bbanis2k

asked on

Using the control's backcolor property

What would I add to my code to use the control's backcolor property to change the control's background color to yellow?


  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
      Dim list As New ArrayList
      GetControls(Me, list)

      lstList.DataSource = list

   End Sub

   Private Sub GetControls(ByVal collection As Control, ByVal list As ArrayList)
      Dim control As Control
      For Each control In collection.Controls
         list.Add(control.Name)

         If (collection.Controls.Count > 0) Then
            GetControls(control, list)

         End If
      Next
   End Sub

End Class ' FrmControlsCollection
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi bbanis2k;

This will do it.

ControlName.BackColor = Color.Yellow

Fernando
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial