Love these forums, I am a beginner when it comes to VB.NET and have run into some trouble.
Here is my Code snippet
'decleare variables
Dim vmcount As Integer
Dim tabcount As Integer
Dim userControl As Control
Dim UserControlName As String
vmcount = combo_vmcount.SelectedItem
tabcount = 1
tab_con_vm.TabPages.Clear()
While (tabcount <= vmcount)
Dim tabname As New TabPage
'Load variables
userControl = New calc_usercontrol_vm
tabname.Text = "VM" & tabcount
tabname.Name = "VM" & tabcount
UserControlName = "UCVM" & tabcount
userControl.Name = UserControlName
'actions
tab_con_vm.TabPages.Add(tabname)
tabname.Controls.Add(userControl)
'next
tabcount = tabcount + 1
End While
End Sub
The trouble I’m having is working out a way to be able to call the objects in the dynamically created usercontrols. I thought a list maybe an option but I am struggling to get the syntax/get it working. Wondering if anyone has some ideas or different approaches..
Thanks Guys
Richard
While this is most likely not the best way to solve the problem, I ended up creating an global array and build the user controls off that.
It’s very basic but I got it working, the answers above are most likely a good solution but I my knowledge of vb.net were not up to scratch.