ent_ttu
Member
- Joined
- Jun 17, 2008
- Messages
- 14
- Programming Experience
- 1-3
First off, I'm pretty new to VB.NET, so I appreciate any assistance. And I have extensively searched for an answer, but I'm apparently not using the correct search terms.
I have a form that queries a database and returns a result set. What I would like to do is create X number of labels, called lblInv1, lblInv2, etc., until I have a label for each record returned.
I've verified that I'm getting the results, but when I display the form, only the first label shows; none of the others appear. I've tried several different ways, with no luck.
I've included my latest code below, and would appreciate any assistance. I'm getting pretty frustrated at this point.
Thanks in advance!
My sub function:
I have a form that queries a database and returns a result set. What I would like to do is create X number of labels, called lblInv1, lblInv2, etc., until I have a label for each record returned.
I've verified that I'm getting the results, but when I display the form, only the first label shows; none of the others appear. I've tried several different ways, with no luck.
I've included my latest code below, and would appreciate any assistance. I'm getting pretty frustrated at this point.
Thanks in advance!
VB.NET:
Do While intLoopCount < intMaxRows
createLabel(intLoopCount)
intLoopCount = intLoopCount + 1
Loop
My sub function:
VB.NET:
Private Sub createLabel(ByVal intLoopCount)
Dim intStart As Integer
Dim lbl As New Label
Dim strLblId As String
Dim strLblName As String
strLblId = CStr(intLoopCount)
strLblName = "lblInv" & strLblId
MsgBox("subroutine no " & strLblName)
lbl.Name = strLblName
lbl.Text = "subroutine " & strLblName
intStart = 570 + (intLoopCount * 100)
lbl.Location = New Point(intStart, 338)
lbl.Size = New Size(300, 300)
Me.Controls.Add(lbl)
End Sub