Hi, I would like to optimize my routine that I use to change the color of a particular button.
This is the routine I use (ChangeColor)
Sub Process_Globals
Private btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn10, btn11, btn12 As Button
Private Colorx As String = Colors.RGB(91,208,18)
End Sub
Sub Application_Start (Nav As NavigationController)
:
:
ChangeColor(4)
End Sub
Sub ChangeColor(btnx As Int)
Select btnx
Case 1
btn1.Color = Colorx
Case 2
btn2.Color = Colorx
Case 3
btn3.Color = Colorx
Case 4
btn4.Color = Colorx
Case 5
btn5.Color = Colorx
Case 6
btn6.Color = Colorx
Case 7
btn7.Color = Colorx
Case 8
btn8.Color = Colorx
Case 9
btn9.Color = Colorx
Case 10
btn10.Color = Colorx
Case 11
btn11.Color = Colorx
Case 12
btn12.Color = Colorx
End Select
End Sub
Any suggestions ?
This is the routine I use (ChangeColor)
Sub Process_Globals
Private btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn10, btn11, btn12 As Button
Private Colorx As String = Colors.RGB(91,208,18)
End Sub
Sub Application_Start (Nav As NavigationController)
:
:
ChangeColor(4)
End Sub
Sub ChangeColor(btnx As Int)
Select btnx
Case 1
btn1.Color = Colorx
Case 2
btn2.Color = Colorx
Case 3
btn3.Color = Colorx
Case 4
btn4.Color = Colorx
Case 5
btn5.Color = Colorx
Case 6
btn6.Color = Colorx
Case 7
btn7.Color = Colorx
Case 8
btn8.Color = Colorx
Case 9
btn9.Color = Colorx
Case 10
btn10.Color = Colorx
Case 11
btn11.Color = Colorx
Case 12
btn12.Color = Colorx
End Select
End Sub
Any suggestions ?