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
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
GetControls(control, list)
End If
Next
End Sub
End Class ' FrmControlsCollection
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This will do it.
ControlName.BackColor = Color.Yellow
Fernando