Results 1 to 9 of 9

Thread: Disabling or Deleting Controls at run time

  1. #1

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Exclamation

    Does anyone know out there how to permenantly set properties of a control or permenantly delete a control like command button or form or anything at run time. Please let me know.

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Most controls have an hWnd property, you can use the destroyWindow API to perminently delete a window declare it like this.

    Code:
    Private Declare Function DestroyWindow Lib "user32" Alias "DestroyWindow" (ByVal hwnd As Long) As Long
    What do you mean perminantly set a property of a control, Just don't change it agauin.

  3. #3

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Sorry, I Didn't understand

    I am unable to follow what you meant, can you explain it a little bit clearly? Suppose if i want to delete a form name "Form1" or command button "cmdFind", can you give me the syntax for that. What is "hWnd"

    However thanks for your reply.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Wink

    Hwnd is the handle ie commandbutton. to delete it, you have to declare the api Sam gave (put it topmost in your form code) and then use Destroywindow commandbutton.hwnd to delete the commandbutton
    Use
    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.

  5. #5

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Smile Thanks, But......

    Thanks for replying but i want to permenantly delete a control. When I deleted a aommand button using the code you and Sam gave the commandbutton was present during the next execution. Please tell me how to delete it permenantly so that it is not present in the next execution.


    Thanks.

  6. #6
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    Your not making yourself very clear

    If you want to delete a control PERMINENTLY then you can ONLY do this at design time and you do it by simply selecting the control and pressing the DELETE Key.

    You CANNOT, EVER, EVER, EVER delete a control at Run-time and make it perminent....

    Thats like putting a square peg in a round hole.

  7. #7

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Exclamation

    Dear GEN-X
    Agreed that we can never delete a control at run time but can we set a controls property o disabled so that it remains disabled for ever until certain event takes place to enable it?

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You could put it into a file, ini or into registry.
    Use
    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.

  9. #9
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    Exactly.

    Use the GetSettings and SaveSettings to determine whether your control is visible when it runs.

    And that is all you have to do, change its visibility... because people cannot interface with something they cannot see.

    Code:
    Control.Visible = False

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