changing background

Alix

Registered User.
Local time
Today, 09:43
Joined
Feb 3, 2003
Messages
32
Is it possible to change the background from a comand button. if so how?:)
 
Presumably you mean the background colour

Unfortunately you can't. But you could use a label and set the 'Special Effect' property to raised so that it looks like a command button. Then use the On-Click event for code.

HTH
Rob
 
Alix said:
Is it possible to change the background from a comand button. if so how?:)

Your wording could be interpreted as 'background colour of the form FROM a command button'

if so then...

Me.Detail.BackColor = RGB colour value here
 
or:

Me.Picture = "path of your picture here"
 
Re: Re: changing background

KevinM said:


Your wording could be interpreted as 'background colour of the form FROM a command button'

if so then...

Me.Detail.BackColor = RGB colour value here

or:

Me.Picture = "path of your picture here".

Yes, I ment the Form background
sorry if i didnt explain clearly
I'll try it out and give you the result
Thanks again
 
Sorry
But I'm not in this stuff
I made a command button and tried using this code:
Code:
Private Sub Command14_Click()
Me.Detail.BackColor = FFFFFF
End Sub
But it doesnt work any idea?
 
Private Sub Command14_Click()
Me.Detail.BackColor = VbRed
End Sub
 
or:

Me.Detail.BackColor = RGB(255, 255, 255)
 
Thanks alot, works properly
sorry another question; is there any way to make it for further clicks for e.g first click red, second one yellow 3rd black etc
 
Code:
Private Sub YourCommandButton_Click
   Static intCount As Integer
   Select Case intCount
      Case Is = 0
         Me.Detail.BackColor = RGB(255, 255, 255) ' red
      Case Is = 1
         Me.Detail.BackColor = RGB(255, 255, 0) ' yellow
      Case Is = 2
         Me.Detail.BackColor = RGB(0, 0, 0) ' black
   End Select
   intCount = intCount + 1
   If intCount = 3 Then intCount = 0
End Sub

you can add the Case Is = 3, 4...n statements in for every colour and just remember to change the If intCount = 3 line to the last number referenced plus 1
 

Users who are viewing this thread

Back
Top Bottom