/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
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

Søg
Reklame
Statistik
Spørgsmål : 177557
Tips : 31968
Nyheder : 719565
Indlæg : 6408885
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste