11 replies
by ash_syed
Hi ,
In response to your question ,
for instance u are having the textbox control or Label disabled , then u can
write a few statements to change its
backcolor or Forecolor using the RGB Function or the QBColor function .
Ex :
Let us assume the name of the label control is Label1
then :
Label1.Forecolor = RGB(255,0,0)
in this case the color red is assigned to the Label
I hp it answers u r question
Thanks
by legna_fg
by ghartlieb
2 approaches come to mind:
1) Use a procedure to disable a control, passing the control as a paramater, which also changes the BackColor property to the color of your choice OR
2) Write a loop such as:
Dim Ctl as Control
Clr = RGB(0,255,0) ' or color of your choice
For Each Ctl in Me.Controls
if Ctl.Disabled then Ctl.BackColor = Clr
next Ctl
This would work well in a Utilities module as a procedure used by many forms - just pass Me as a parameter.
This technique can be applied to using the Tag property to see if a control should be enable or disabled under certain conditions - you could set the color at that time as well.
by legna_fg
by ghartlieb
A correction to my previous answer:
You would use: IF NOT Ctl.Enabled THEN Ctl.BackColor = Clr
by legna_fg
by vladm
For change of color of Control on any condition, for example, accessible / inaccessible it is necessary to use change of properties Color and ForeColor on event OnRecord, which occurs with transition between records of a source of the given form, and also with opening the form.
If it is necessary to trace a condition of an element of management during manipulation with the form - use event AfterUpdate of appropriate Control.
These actions cannot be carried out, when the form is in a tape kind- viewing of several records simultaneously.
by legna_fg
by donq
If Me.[disabledFieldName].Disabled = "True" Then [disabledFieldName].Backcolor = 12632256 Else [disabledFieldName].Backcolor = 16777215 EndIf
I always call up the color box and paste the color # I want in the clipboard, then open my code snippet and copy the clipboard contents behind the equal sign. I use this inside GotFocus() and LostFocus() regularly to turn the field with focus background color to white, and then back to my Forms primary color so the user never has to hunt for a flashing cursor. Use any colors you want this way without screwing up??? Have fun Don Quigg
by legna_fg
by legna_fg
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending