I'm betting that if you step through that code with F8, you will find your error at the line control.index = 0, because at that point, it has not been created yet...
Also, if you want to create controls and have them in an array, then you need to set the control on the form at design time and set its index to zero and load copies from there...
Another Also, the reason we have control arrays is because several controls can have the "SAME" name, i.e. Label1 and each is then referenced by its index number (0), and the reason I bring this up is because you are naming controls ttbco_0, ttbco_1 and as such they are not considered an array because each control as a seperate and unique identifier...
'Simple example of adding controls dynamically at runtime.
'Be sure a CommandButton with name = "Command1" and Index=0 is on the form prior to running code.
Private Sub Command1_Click(Index As Integer)
MsgBox "This command button's index in the array is " & Index & "."
Private Sub Form_Load()
addRTC 'this will be control with index = 1
addRTC 'this will be control with index = 2
'Remember control with index = 0 must already exist
Public Sub addRTC()
'Add control dynamically at run time
Dim ctlCount As Integer
Dim NewIndex As Integer
Dim I As Integer
'Check to see that first control exists
ctlCount = -1
For I = 0 To Me.Controls.Count - 1
If Me.Controls(I).Name = "Command1" Then
ctlCount = ctlCount + 1
NewIndex = ctlCount + 1
Command1(NewIndex - 1).Visible = True
'Create New Control and Set Properties
.Caption = Command1(0).Name & "(" & Str(NewIndex) & ")"
.Top = Command1(NewIndex - 1).Top + Command1(NewIndex - 1).Height + 100
.Left = Command1(NewIndex - 1).Left
.Width = Command1(NewIndex - 1).Width
.Visible = True
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...