Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of labels

Status
Not open for further replies.

mayu03

Programmer
Oct 3, 2003
91
US
I am trying to create dynamicaly an array of label based on the recordset value. What am I doing wrong?

For i = 0 To rs.RecordCount
While Not rs.EOF
Set lblInput(i) = Main.Controls.Add("VB.Label", rs("PlanChangeDesc"))
With lblInput(i)
.Width = 3000
.Height = 3000
End With
rs.MoveNext
Next i
Wend
 
I notice that you haven't found any of the answers given to you helpful!. You might read faq222-2244 to find ways of getting better answers.

If you have found any answers helpful, read faq222-2244 to see how to acknowledge the answers.

For this question, you've got 2 interlocking loops. You may do better just to use the rs.eof to determine when you're at the end of your recordset:

If NOT rs.BOF AND rs.EOF Then
Do While Not rs.EOF
' do your bits here
'
i = i + 1
MoveNext
Loop
End If

You will also probably need to set either .Top or .Left so your controls are not overlapping

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top