S
squigster
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(recipeStepNumberLabel(panelIdx))
recipeStepNumberLabel(panelIdx).Left = 3
recipeStepNumberLabel(panelIdx).Top = 34 + (26 * (panelIdx - 1))
recipeStepNumberLabel(panelIdx).Width = 26
recipeStepNumberLabel(panelIdx).Height = 22
' I call the routine here!!
Call SetPanelFontAndColor(recipeStepNumberLabel)
' ROUTINE
Public Sub SetPanelFontAndColor(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(passedInControl(idx)) Then
passedInControl(idx).Font = SystemDefaultFont '
Set The Font
passedInControl(idx).BringToFront()
' Bring Control To Front
passedInControl(idx).BackColor = Color.Wheat '
Set The BackColor
End If
Next idx
Exit Sub
Catch ex As Exception
If MsgExceptionFlag = 1 Then
MessageBox.Show("Center Form" + ex.Message) ' Display
During Testing
Else
SystemExceptionHandler(ex) ' Write
To File In Live Mode
End If
End Try
End Sub
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(recipeStepNumberLabel(panelIdx))
recipeStepNumberLabel(panelIdx).Left = 3
recipeStepNumberLabel(panelIdx).Top = 34 + (26 * (panelIdx - 1))
recipeStepNumberLabel(panelIdx).Width = 26
recipeStepNumberLabel(panelIdx).Height = 22
' I call the routine here!!
Call SetPanelFontAndColor(recipeStepNumberLabel)
' ROUTINE
Public Sub SetPanelFontAndColor(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(passedInControl(idx)) Then
passedInControl(idx).Font = SystemDefaultFont '
Set The Font
passedInControl(idx).BringToFront()
' Bring Control To Front
passedInControl(idx).BackColor = Color.Wheat '
Set The BackColor
End If
Next idx
Exit Sub
Catch ex As Exception
If MsgExceptionFlag = 1 Then
MessageBox.Show("Center Form" + ex.Message) ' Display
During Testing
Else
SystemExceptionHandler(ex) ' Write
To File In Live Mode
End If
End Try
End Sub