i have 20 text boxes and 20 my.settings variables
textboxes and my.settings variables have the same names
textbox name: mid0 and it has the value of my.settings.mid0
the text boxes are created in runtime
and i have a save button and that will save the values of the text boxes in my.settings variables
here is the code
Dim Ctl As Control
Dim MyTextbox As TextBox
For i As Integer = 0 To 20
Ctl = tabc.TabPages(6).Controls.Item("mid" & i.ToString)
If Ctl IsNot Nothing Then
MyTextbox = CType(Ctl, TextBox)
My.Settings.("mid" & i.ToString) = MyTextbox.Text 'this line is the problem
End If
Next
so how do i loop through the my.settings variables?
which goes form mid0 to mid20
i tried
CallByName(My.Settings, "mid" & i.ToString, CallType.Set) = MyTextbox.Text
but i get an error “Expression is a value and therefore cannot be the target of an assignment.”
change the My.Settings line to
which really amounts to removing the period 🙂