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.
Printable View
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.
Most controls have an hWnd property, you can use the destroyWindow API to perminently delete a window declare it like this.
What do you mean perminantly set a property of a control, Just don't change it agauin.Code:
Private Declare Function DestroyWindow Lib "user32" Alias "DestroyWindow" (ByVal hwnd As Long) As Long
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.
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
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.
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.
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?
You could put it into a file, ini or into registry. :)
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