Results 1 to 2 of 2

Thread: [RESOLVED] Create label in one sub, destory in another?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2010
    Posts
    28

    Resolved [RESOLVED] Create label in one sub, destory in another?

    When the form first loads there are two global variables (assigned values in the form load sub as a default) that set the number of days back in time and how many days ahead events will be displayed (in an array of labels). If the user wants to view more events (or less events) the number of labels displayed (and the text they contain) will change. I have one sub (code below)that creates an array of labels.

    What I can't seem to do is find a way to blow them off the form and "re-instantiate" as many as I need for the new user selectable range.

    Code:
     
    
    Private Sub CreateDisplayLabels()
            Dim lblEvent(1000) As Label
            Dim I As Integer
    
            For I = 0 To DisplayCounter - 1
                lblEvent(I) = New Label
                With lblEvent(I)
                    .Name = CStr(I)
    		:
    		
    		:
                 End With
                Me.Controls.Add(lblEvent(I))
                AddHandler lblEvent(I).Click, AddressOf Label_Click
    
            Next I
    End Sub
    Any and all ideas are welcome and appreciated.
    Last edited by n_minus_one; Jan 9th, 2011 at 05:53 PM. Reason: clarification

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Dec 2010
    Posts
    28

    Re: Create label in one sub, destory in another?

    Sorry. It never fails: It is only after I post a problem do I get things working.

Tags for this Thread

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