[Gambas-user] - Populating a Combobox from a DB

Doriano Blengino doriano.blengino at ...1909...
Fri Aug 1 18:43:59 CEST 2008


John K ha scritto:
> Re my earlier e-mail I've solved the problem by repopulating the 
> combobox at the end of the Button_Click() subroutine.
> However I have another question. If I create a combobox with:
> DIM hComboBox AS ComboBox
> hComboBox = NEW ComboBox ( Frame1 )
>
> it doesn't accept any events ie hComboBox_Change()
>   
You should instanciate it with:

   hComboBox = NEW ComboBox(Frame1) as "mycmbbox"

(note the "as xxxxx"). Then declare:

   public sub mycmbbox_change()
   .....

The toolbox works because it does automatically something similar. Ask 
Benoit, he knows better than me: the interpreter does know nothing about 
variable names, so if you rely on variable names to manage events, you fail.

Regards.





More information about the User mailing list