JDP
February 18th, 2003, 03:09 AM
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 :-
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
and I called it from a Label_Click event in the usual way
ChangePanelTextColor(<Name of Panel containing this Label>)
Have I missed something really obvious and basic here ? Or do I have to go about it in a completely different way?
JDP
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 :-
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
and I called it from a Label_Click event in the usual way
ChangePanelTextColor(<Name of Panel containing this Label>)
Have I missed something really obvious and basic here ? Or do I have to go about it in a completely different way?
JDP