Results 1 to 7 of 7

Thread: Help!!! for removing controll added at run time

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Posts
    260

    Help!!! for removing controll added at run time

    Dear friends

    I have created some controls at run time by using the following code


    Private Sub Command1_Click()
    Load Text1(Text1.UBound + 1)
    Text1(Text1.UBound).Top = Text1(Text1.UBound - 1).Top + 300
    Text1(Text1.UBound).Visible = True
    End Sub


    I also want to remove these controls at run time but I do not know the code for that


    Plz!!! help me

    Its urgent

    Thanks in advance

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: Help!!! for removing controll added at run time

    Unload Text1(Text1.UBound)
    Frans

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help!!! for removing controll added at run time

    Just unload them:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command2_Click()
    4.   Unload Text1(Text1.UBound)
    5. End Sub
    6.  
    7. Private Sub Form_Load()
    8.   Text1(0).Text = ""
    9. End Sub
    10.  
    11. Private Sub Command1_Click()
    12.   Load Text1(Text1.UBound + 1)
    13.   Text1(Text1.UBound).Top = Text1(Text1.UBound - 1).Top + 300
    14.   Text1(Text1.UBound).Visible = True
    15. End Sub

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Help!!! for removing controll added at run time

    I have never seen the property UBound for textboxes, is there any?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help!!! for removing controll added at run time

    If they are a control array

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Help!!! for removing controll added at run time

    Hmmmnnn... I see...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Help!!! for removing controll added at run time

    If it is a control array it is a collection object with .LBound and .UBound properties. To access each control you need to reference it by index. If it is not an array then it just points to the control itself.

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