How can I create a "common" ComboBox?

Wondering if there is a way to create a commonly used ComboBox that is used on several windows?

I’d like it so that this ComboBox would be populated with data from a MySQL table (which I already know how to do) upon startup of the app and then I could use this same Combobox on more than one window which, as I see it, would eliminate the need to populate it each and every time a window opens that has it.

create a subclass of the Combobox which include any new properites, or data population routines…
then use THAT on each of your windows.

[quote=39643:@Dave S]create a subclass of the Combobox which include any new properites, or data population routines…
then use THAT on each of your windows.[/quote]

From where would I cause it to be populated? In the App’s Open event?

no… the open event of the subclass you create.
or you can create a POPULATE method in the subclass and call it

For something like this, I would add a shared property to your subclass (I usually use a dictionary) to store the values retrieved from the DB.

In the ‘Open’ event of your subclass, create the dictionary and retrieve the data. pseudo code to follow (assuming dictDataStorage o be your shred dictionary property):

if (dictDataStorage is nil) then
     ' First time run, create ditionary and populate from DB
     dictDataStorage = new dictionary
     // Get data from your DB, add to dictDataStorage
     .....
end if

' Populate your combobox/listbox/etc rows from dictDataStorage here

// If you need to further handle the 'Open' event in each control intance, Create an 'Open' event in your subclass, and add a Raise event 'Open' line here
RaiseEvent Open

[quote=39663:@Dave S]no… the open event of the subclass you create.
or you can create a POPULATE method in the subclass and call it[/quote]

Great, thanks. Tried and it works.

[quote=39664:@Mark Walsh]For something like this, I would add a shared property to your subclass (I usually use a dictionary) to store the values retrieved from the DB.

In the ‘Open’ event of your subclass, create the dictionary and retrieve the data. pseudo code to follow (assuming dictDataStorage o be your shred dictionary property):

[code]
if (dictDataStorage is nil) then
’ First time run, create ditionary and populate from DB
dictDataStorage = new dictionary
// Get data from your DB, add to dictDataStorage

end if

’ Populate your combobox/listbox/etc rows from dictDataStorage here

// If you need to further handle the ‘Open’ event in each control intance, Create an ‘Open’ event in your subclass, and add a Raise event ‘Open’ line here
RaiseEvent Open
[/code][/quote]

For this I would have to do some “learning” as this is beyond my knowledge level … but I do like to learn.