You cannot create a control reference from a string variable:
Dim strVar As String = "MyControl"
...
For n As Integer = 0 To 3
Dim thisVar As String = strVar &= n.Tostring
thisVar = New NuControl ' already declared as String,
' cant ALSO be NuControl Type!
...
theForm.Controls.Add(thisVar)
Next n
How would your code ever keep track of such things?? strVar/thisVar is a variable and can change (vary) so you'd quickly loose track of them. How would the compiler know how to handle it? Would thisVar = "" reset the string or destroy the Control?
For dynamically added controls, you often need a way to track the ones added, especially when you dont know how many there will be. To create multiple user controls with the same code at runtime:
Dim btn As Button ' tmp var
Dim myBtns As New List(Of Buttons) ' my tracker
' create 3 buttons:
For n As Integer = 0 To 3
btn = New Button ' create a New button
btn.Top = ...
btn.Left = ... ' set props
btn.Name = "Button" & n.ToString
AddHandler .... ' hook up any event handlers
theForm.Controls.Add(btn) ' add to form
myBtns.Add(btn) ' add to my list
Next n
What matter to the code is the ability to get at those controls we created, which is via an object reference. To disable our buttons:
For n As Integer = 0 to myBtns.Count - 1 ' could be 3, could be 103
myBtns(n).Enabled = False
Next n
Note that if the controls you create can be deleted on the fly as well, that you need to dispose of them properly should you remove them from the form since you created them.