Hi All,
I have an application with many buttons, the button names are btn1, btn2, btn3, and so on.. I need to change a property of the buttons based events. Currently I have large looping structures to conditionally check each button.. for example;
For btn = 0 To 62
If btn = 0 Then
If ds.Tables("IRSC").Rows(btn).Item(6) = 1 Then
btn0.Image = xImage
Else
btn0.Image = Nothing
End If
End If
If btn = 1 Then
If ds.Tables("IRSC").Rows(btn).Item(6) = 1 Then
btn1.Image = xImage
Else
btn1.Image = Nothing
End If
End If
and so on...
I would like to concatenate a string with the word btn and a variable numeric (btnString = "btn" & btn_number) instead of a hard coded button name as shown above.
so, instead of this; btn0.Image = xImage
I would use something like this; btnString.Image = xImage
where btnString is a concatenated value
This would enable me to simplify the loops. Could not find a clue searching reference books or the Internet. Any suggestions that can point in the right direction will be very much appreciated.
Thanks
I have an application with many buttons, the button names are btn1, btn2, btn3, and so on.. I need to change a property of the buttons based events. Currently I have large looping structures to conditionally check each button.. for example;
For btn = 0 To 62
If btn = 0 Then
If ds.Tables("IRSC").Rows(btn).Item(6) = 1 Then
btn0.Image = xImage
Else
btn0.Image = Nothing
End If
End If
If btn = 1 Then
If ds.Tables("IRSC").Rows(btn).Item(6) = 1 Then
btn1.Image = xImage
Else
btn1.Image = Nothing
End If
End If
and so on...
I would like to concatenate a string with the word btn and a variable numeric (btnString = "btn" & btn_number) instead of a hard coded button name as shown above.
so, instead of this; btn0.Image = xImage
I would use something like this; btnString.Image = xImage
where btnString is a concatenated value
This would enable me to simplify the loops. Could not find a clue searching reference books or the Internet. Any suggestions that can point in the right direction will be very much appreciated.
Thanks