I have a Form with a number of Panels and each panel contains a large number of labels and pictureboxes.
When the user clicks on any label, I want the text forecolor of all the labels in that particular panel to change to another color .
I thought I could do it with this Sub, but it throws an error :-
and I called it from a Label_Click event in the usual wayCode:Private Sub ChangePanelTextColor(ByRef PN As Panel) Try Dim l As Label For Each l In PN.Controls l.ForeColor = System.Drawing.Color.BurlyWood Next Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub
Have I missed something really obvious and basic here ? Or do I have to go about it in a completely different way?Code:ChangePanelTextColor(<Name of Panel containing this Label>)
JDP




Reply With Quote