T
Terrell Miller
I'm trying to add code to a form so when option groups get
the focus they will be highlighted (yellow, in this case).
I just use conditional formatting for the textboxes, but
you can't do that with OGs.
I have the following handlers for a typical option group:
Private Sub ogClinic_Enter()
Call HighlightOG(Me.ActiveControl, True)
End Sub
Private Sub ogClinic_Exit(Cancel As Integer)
Call HighlightOG(Me.ActiveControl, False)
End Sub
....and here's the subroutine they call:
Sub HighlightOG(ThisControl As Control, bEnter As Boolean)
Dim lColor As Long
Select Case bEnter
Case True: lColor = lBGYellow
Case Else: lColor = lBGWhite
End Select
ThisControl.BackColor = lColor
End Sub
where
Public Const lBGYellow As Long = 8454143
Public Const lBGWhite As Long = 16777215
The handlers execute when they're supposed to and don't
generate any error codes. The ThisControl object points to
the right place, and I can see the BackColor property
change value correctly in the Watch window as the handler
executes.
But the option group never changes color onscreen!
I can do it manually with the Fill/BackColor button and it
works fine, the OG changes color. But the VBA subs don't
do nuthin'
Any ideas why the color doesn't change onscreen?
TIA,
the focus they will be highlighted (yellow, in this case).
I just use conditional formatting for the textboxes, but
you can't do that with OGs.
I have the following handlers for a typical option group:
Private Sub ogClinic_Enter()
Call HighlightOG(Me.ActiveControl, True)
End Sub
Private Sub ogClinic_Exit(Cancel As Integer)
Call HighlightOG(Me.ActiveControl, False)
End Sub
....and here's the subroutine they call:
Sub HighlightOG(ThisControl As Control, bEnter As Boolean)
Dim lColor As Long
Select Case bEnter
Case True: lColor = lBGYellow
Case Else: lColor = lBGWhite
End Select
ThisControl.BackColor = lColor
End Sub
where
Public Const lBGYellow As Long = 8454143
Public Const lBGWhite As Long = 16777215
The handlers execute when they're supposed to and don't
generate any error codes. The ThisControl object points to
the right place, and I can see the BackColor property
change value correctly in the Watch window as the handler
executes.
But the option group never changes color onscreen!
I can do it manually with the Fill/BackColor button and it
works fine, the OG changes color. But the VBA subs don't
do nuthin'
Any ideas why the color doesn't change onscreen?
TIA,