|
| making a new button when the program runs Fra : fish |
Dato : 07-12-01 15:09 |
|
Hey,
I'm making a program, where it is possible to at a button when the program
runs. I have just the next code for this:
set cmdobject=form1.controls.add("VB.commandbutton","namebutton")
cmdobject.visible=true
cmdobject.caption="textonbutton"
When I start this program, the button appears and the name and text are
correct. But when I use this code:
private sub namebutton_click()
action
end sub
He don't want to do the action when I click on the button, neither when I
use the name cmdobject in stead of namebutton. What do I wrong?
thanks
| |
Frank Bertelsen (10-01-2002)
| Kommentar Fra : Frank Bertelsen |
Dato : 10-01-02 19:21 |
|
Hi there,
Declare the object variable in the following way at module level on the form:
Private WithEvents cmdobject As VB.CommandButton
That should to the trick.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
| |
|
|