Hello Everyone,
I am having a problem when I pass a control to a routine and I want to
set properties for the control I cannot determine a way to retrieve the
passed in controls index so that I can set the properties for the
specific index. The routine blows up after the first time through. The
If idx = statement is screwed up. Any help would be appreciated.
Thanks, Jim
My code is as follows:
' I create the control here
' Add Recipe Step Number Panels 1 thru 12
pnlSteps1thru12 .Controls.Add(r ecipeStepNumber Label(panelIdx) )
recipeStepNumbe rLabel(panelIdx ).Left = 3
recipeStepNumbe rLabel(panelIdx ).Top = 34 + (26 * (panelIdx - 1))
recipeStepNumbe rLabel(panelIdx ).Width = 26
recipeStepNumbe rLabel(panelIdx ).Height = 22
' I call the routine here!!
Call SetPanelFontAnd Color(recipeSte pNumberLabel)
' ROUTINE
Public Sub SetPanelFontAnd Color(ByVal passedInControl () As Control)
Dim idx As Integer
Try
' Loop Through The Controls And Look For The Passed In
Index, Then Set The Control Properties
For idx = 1 To MAX_PLC_RECIPE_ STEPS
If idx =
passedInControl (idx).Controls. IndexOf(passedI nControl(idx)) Then
passedInControl (idx).Font = SystemDefaultFo nt '
Set The Font
passedInControl (idx).BringToFr ont()
' Bring Control To Front
passedInControl (idx).BackColor = Color.Wheat '
Set The BackColor
End If
Next idx
Exit Sub
Catch ex As Exception
If MsgExceptionFla g = 1 Then
MessageBox.Show ("Center Form" + ex.Message) ' Display
During Testing
Else
SystemException Handler(ex) ' Write
To File In Live Mode
End If
End Try
End Sub