Results 1 to 3 of 3

Thread: remove dynamic label/txtbox from form

  1. #1
    Guest

    Angry

    I am trying to remove dynamically created textboxes and labels that I created on a form. The event that I want to remove them with is the click on a combo box. Microsoft help tells me I cannot do an unload of these controls with the combo event.

    The txt and lbl are created dynamically based on a recordset retrieved from the new combo value. I have it working from a clear form button, but this is junky looking. It should clear on the new selection in the combo.

    Any ideas of how to get around this?

    Thanks in advance!!!!!

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    try adding a timer to your form and setting it's interval to 1 and disable it at start.

    add something like this to your form

    Code:
    Dim objRemove As Object
    
    Private Sub Timer1_Timer()
    Unload objRemove
    Set ObjRemove = Nothing
    Timer1.Enabled = False
    End Sub
    
    Private Sub RemoveObject (Obj as Object)
    Set objRemove = Obj
    Timer1.Enabled = True
    End Sub
    Then use the remove object sub to remove your control

    Hope this helps.

  3. #3
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    or you can use load

    Have a text array,
    for example.
    txtBoxes(0)

    to create a new "txtBoxes(0)"
    Code:
    Dim MaxID As Integer
    MaxID = txtBoxes.Count
    Load txtBoxes(MaxID)
    to delete:
    Code:
    Dim MaxID As Integer
    MaxID = txtBoxes.Count
    UnLoad txtBoxes(MaxID)

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