I was just wondering is there anyway to set the indexes of controls made at runtime, after they are created, or is this impossible???
Printable View
I was just wondering is there anyway to set the indexes of controls made at runtime, after they are created, or is this impossible???
I tried the code to add a control at runtime and set its index property. Since the index property is read-only at runtime, the program does not work. In short, you cannot set index values of controls at runtime. Following is my code:
The 'txtNew.Index = 0' line fires an error.Code:Option Explicit
Dim WithEvents txtNew As TextBox
Private Sub Command1_Click()
Set txtNew = Me.Controls.Add("VB.TextBox", "NewTextBox")
txtNew.Index = 0
End Sub