Results 1 to 3 of 3

Thread: [RESOLVED] Add - Remove Array Textbox,label,ecc

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Resolved [RESOLVED] Add - Remove Array Textbox,label,ecc

    Hi guys,

    I have a problem...im able to make array of textboxes ecc...but i cant remove them...listbox has the REMOVE item fucntion...but textboxes and labels dont

    So do you have any ideas how to REMOVE an array like textbox?

    This is my code for adding object arrays :
    Code:
     Dim intNext As Integer
        Dim lngTop As Long
        
        ' find the next control
        intNext = txtLoadedUser.Count
        
        ' find the next top
        lngTop = txtLoadedUser(intNext - 1).Top + txtLoadedUser(intNext - 1).Height + 80
        
        ' add new controls
        Load lblForumName(intNext)
        Load txtLoadedUser(intNext)
        Load lblWaiting(intNext)
        Load txtLoadedPass(intNext)
        Load txtSid(intNext)
        Load txtU(intNext)
        Load txtK(intNext)
        
        With lblForumName(intNext)
            .Top = lngTop
            .Left = lblForumName(intNext - 1).Left
            .Visible = True
        End With
        
        With txtLoadedUser(intNext)
            .Top = lngTop
            .Left = txtLoadedUser(intNext - 1).Left
            .Visible = True
            .TabIndex = txtLoadedUser(intNext - 1).TabIndex + 2
            .Text = ""
        End With

    CHeers
    Thanks for helping me out.

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Add - Remove Array Textbox,label,ecc

    You can remove Controls by specifying a single index:
    Code:
    Unload txtLoadedUser(1)
    Or in a loop (for a complete Array):
    Code:
    Dim lX As Long
    
    For lX = txtLoadedUser.UBound To 1 Step -1
      Unload txtLoadedUser(lX)
    Next lX
    However, you cannot remove items in run time that were added in design time. In your case, 0 - zero.

    Creating a completely new Control array in run time requires a more complex solution. Search the forums.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Re: Add - Remove Array Textbox,label,ecc

    Thanks for the fast reply...

    WIll try that!
    Thanks for helping me out.

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