bpeirson
Member
I am just starting to get back into VB programming, and I'm looking for a more elegant solution to an application I'm developing for a production line.
I have a series of labels with manufacturing steps. The background color of the steps needs to change to green as the process steps through. Right now it is working as it should, it just seems a little too much like brute force programming.
Right now I'm using a Select statement to change the color of EACH label. The first portion of the Select statement is below. With this method I have to do this same thing for each case...
' Select Case ScreenStep.Value
' Case 0
' lblStep1.BackColor = Color.Gray
' lblStep1Text.BackColor = Color.Gray
' lblStep2.BackColor = Color.Gray
' lblStep2Text.BackColor = Color.Gray
' lblStep3.BackColor = Color.Gray
' lblStep3Text.BackColor = Color.Gray
' lblStep4.BackColor = Color.Gray
' lblStep4Text.BackColor = Color.Gray
' lblStep5.BackColor = Color.Gray
' lblStep5Text.BackColor = Color.Gray
' lblStep6.BackColor = Color.Gray
' lblStep6Text.BackColor = Color.Gray
' lblStep7.BackColor = Color.Gray
' lblStep7Text.BackColor = Color.Gray
' lblStep21.BackColor = Color.Gray
' lblStep21Text.BackColor = Color.Gray
Does anyone have a suggestion for a "cleaner" way to do this?
I have a series of labels with manufacturing steps. The background color of the steps needs to change to green as the process steps through. Right now it is working as it should, it just seems a little too much like brute force programming.
Right now I'm using a Select statement to change the color of EACH label. The first portion of the Select statement is below. With this method I have to do this same thing for each case...
' Select Case ScreenStep.Value
' Case 0
' lblStep1.BackColor = Color.Gray
' lblStep1Text.BackColor = Color.Gray
' lblStep2.BackColor = Color.Gray
' lblStep2Text.BackColor = Color.Gray
' lblStep3.BackColor = Color.Gray
' lblStep3Text.BackColor = Color.Gray
' lblStep4.BackColor = Color.Gray
' lblStep4Text.BackColor = Color.Gray
' lblStep5.BackColor = Color.Gray
' lblStep5Text.BackColor = Color.Gray
' lblStep6.BackColor = Color.Gray
' lblStep6Text.BackColor = Color.Gray
' lblStep7.BackColor = Color.Gray
' lblStep7Text.BackColor = Color.Gray
' lblStep21.BackColor = Color.Gray
' lblStep21Text.BackColor = Color.Gray
Does anyone have a suggestion for a "cleaner" way to do this?