Changing a Control's BackColor w/Code

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

Hi. I have several forms with a listbox and would like
to change the BackColor from a procedure that I
can call from each form's Load event(or what ever
event is relevant.
Any help will be appreciated.

James
 
JamesJ said:
Hi. I have several forms with a listbox and would like
to change the BackColor from a procedure that I
can call from each form's Load event(or what ever
event is relevant.


I suppose you want a procedure to do that?

Public Sub SetBackColor(ctl As Control)
ctl.BackColor = RGB(255, 192, 192) ' pink
End Sub

Then the Load event can call the procedure:

SetBackColor(Me.listboxname)
 
Works fine. Thanks.

James

Marshall Barton said:
I suppose you want a procedure to do that?

Public Sub SetBackColor(ctl As Control)
ctl.BackColor = RGB(255, 192, 192) ' pink
End Sub

Then the Load event can call the procedure:

SetBackColor(Me.listboxname)
 
Back
Top