Results 1 to 3 of 3

Thread: Remove Runtime added controls using collections

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000


    I am using a collection in order to track controls added
    during runtime. How do I delete these controls when I am finished with them?
    Vin Lis

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    unload coll(Index)
    coll.Remove Index
    [Edited by kedaman on 10-13-2000 at 04:55 PM]
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Deleting controls is the same as "deleting" (called closing in programming terminology) an App.

    Add the following to a Form with 2 CommandButtons called Command1 and Command2. When you press Command2, it will close (delete) Command1.
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    Private Const WM_CLOSE = &H10
    Private Sub Command2_Click()
        SendMessage Command1.hwnd, WM_CLOSE, 0, 0
        DestroyWindow Command1.hwnd
    End Sub

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