CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2000
    Posts
    15

    How to work with array of labels?

    I'm having problems with the following code:

    Private Sub Form_Load()
    Dim test(5) As Label
    Dim a As Integer

    Grid.Col = 0
    For a = 1 To 10
    test(a).LinkTopic = "REUTER|IDN"
    test(a).LinkItem = "SE0" & a & "01T=,BID"
    test(a).LinkMode = 1

    Grid.Row = a
    Grid.Text = test(a).Caption
    Grid.Rows = a + 1
    Next a
    End Sub

    I get error message 91: "object variable or with block variable not set". What the hell is wrong?


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: How to work with array of labels?

    you didn't tell us the line where the error occurred, so I am only guessing.
    You need to Load the elements of your control array:

    Grid.Col = 0
    For a = 1 To 10
    Load test(a)
    test(a).LinkTopic = "REUTER|IDN"
    test(a).LinkItem = "SE0" & a & "01T=,BID"



  3. #3
    Join Date
    Oct 2000
    Posts
    15

    Re: How to work with array of labels?

    I forgot to mention where the error occurred. It is on the line:

    'test(a).LinkTopic = "REUTER|IDN"'

    I tried to Load Test(a), but it still did not work.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured