Reputation: 87
I've multiples CheckBoxes named "CB_0", "CB_1", "CB_2" and so far... I'm trying to change their "Checked" state, but "Controls" doesn't recognize the "Checked" property.
My line of code is like this:
Dim i As Integer = 0
Controls($"CB_{i}").Checked = True
It doesn't works, but if I use this:
CB_0.Checked = True
It works, how can I fix that?
Note:
If I try to change it text, it works:
Dim i As Integer = 0
Controls($"CB_{i}").Text = "Hello"
Upvotes: 0
Views: 1044
Reputation: 530
Is this what your looking for?
Dim i As Integer = 0
CType(Controls($"CB_{i}"), CheckBox).Checked = True
Upvotes: 1