I really have a BIG problem in making control arrays.
The following is what i fed to the PC
dim Sam(n) as textbox
for n=1 to 15
It won't work.
Yuo can not create a control just like that. You have to set the control to something. That is the error that you are getting.
This will do the trick:
Dim sam(15) As TextBox
For i = 1 To 15
Set sam(i) = Controls.Add("vb.TextBox", "sam" & i)
sam(i).Visible = True
sam(i).Text = sam(i).Name
sam(i).DragMode = 0
If i <> 1 Then
sam(i).Left = sam(i - 1).Left + sam(i - 1).Width
the last part of the code is so they don't overlap and you can see them all next to each other.
You could also use load... which works just as well. Start a new project, and add a textbox... leave it's name alone (Text1). In The Properties Box, change index to 0. Now, in your form load (or in a button) add this:
For I = 0 To 9
If I <> 0 Then
Text1(I).Top = Text1(I - 1).Top + Text1(I - 1).Height
Text1(I).Visible = True