locked
How can I create an array of label !!! RRS feed

  • Question

  • My code looks like this :

    Dim lb(10) As System.Window.Form.Label
    Dim i As Integer
    For i=0 to 9

    lb(i) = New System.Window.Form.Label()
      lb(i).Text = "test"
      lb(i).Visible = true
      Me.Controls.Add(lb(i))
    next

    I'll be so glad to get some solution ^^

    Wednesday, May 23, 2007 10:07 PM

Answers

  • I dont see and code in here that actually positions the labels.

     

    In order to see them on the form, you need to determine a position for them to appear.

     

     

    Code Snippet

    Dim lb(10) As Label

    Dim i As Integer

    For i = 0 To 9

    lb(i) = New Label

    lb(i).Text = "test"

    lb(i).Visible = True

    lb(i).Top = i * 20

    lb(i).Left = i * 20

    Me.Controls.Add(lb(i))

    Next

     

    Wednesday, May 23, 2007 10:38 PM

All replies

  • I forgot to explain what error is happend to me Stick out tongue

    there are many gaps and new lines in my form that i think label would be there but it seem to be invisible ??

    ^^ thx a lot for you help

    Wednesday, May 23, 2007 10:11 PM
  • There are many gaps and new lines in my form that i think array of label would be there but it seem to be invisible ??

    thx a lot for your help
    Wednesday, May 23, 2007 10:14 PM
  • I dont see and code in here that actually positions the labels.

     

    In order to see them on the form, you need to determine a position for them to appear.

     

     

    Code Snippet

    Dim lb(10) As Label

    Dim i As Integer

    For i = 0 To 9

    lb(i) = New Label

    lb(i).Text = "test"

    lb(i).Visible = True

    lb(i).Top = i * 20

    lb(i).Left = i * 20

    Me.Controls.Add(lb(i))

    Next

     

    Wednesday, May 23, 2007 10:38 PM
  • i got it thx a lot ^o^
    Thursday, May 24, 2007 3:29 AM