Passing form to a sub procedure

  • Thread starter Thread starter Jean Christophe Avard
  • Start date Start date
J

Jean Christophe Avard

Hi! I have a sub procedure that populate a combo box. I have that same combo
box on many form. So I would like to pass the form that call the sub as a
parameter of the sub procedure...
somthing l;ike this...


Public Sub populateFamilyCombo(ByVal this As form)

this.combobox.text = "blahblah example"

end sub



and I'd call it like populateFamilyCombo(me)

Anyone!?!?!?!?
 
Jean Christophe Avard said:
Hi! I have a sub procedure that populate a combo box. I have that same
combo box on many form. So I would like to pass the form that call the sub
as a parameter of the sub procedure...
somthing l;ike this...


Public Sub populateFamilyCombo(ByVal this As form)

this.combobox.text = "blahblah example"

end sub



and I'd call it like populateFamilyCombo(me)

Anyone!?!?!?!?

Why don't you pass the combobox instead of the whole form?

Better approach is probably to derived your own combo from the default
combobox and add the code there. Afterwards, put your own combo on each
form. You won've have to pass anything.

Armin
 
thank you guy!


Armin Zingler said:
Why don't you pass the combobox instead of the whole form?

Better approach is probably to derived your own combo from the default
combobox and add the code there. Afterwards, put your own combo on each
form. You won've have to pass anything.

Armin
 
Back
Top