473,804 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set background color in pushed button of Option Group.

I use a sewt of buttons, created from the "Option Group". I would like
to have the pushed button appearing in another color, so it is more
clearier which button is pushed. How to proceed it? I am an amateur in
VB.

Bart

Nov 13 '05 #1
4 3225
Hi Bart,

I dont know if you can set the colour of the buttons, but you CAN set
the colour of the Text on the buttons.

Assuming you have two buttons in your option group, do this:

In design mode, set the colour of the ForeColor of the button to red

Then in the AfterUpdate() of your option group, add the following code:

Private Sub fraMine_AfterUp date()

If Me.fraMine.Valu e = 1 Then
Me.btnOne.ForeC olor = 255 'red
Me.btnTwo.ForeC olor = 0 'black
Else
Me.btnOne.ForeC olor = 0 'black
Me.btnTwo.ForeC olor = 255 'red
End If

End Sub
-----------------

Now the text colour on the buttons will toggle as you move between the
two.

HTH

Jean

Nov 13 '05 #2
Jean,

Thanks for your input. It works wihtin the record.
However, when I move to the next record, the color is not accoridng to
the value of the button, pressed when passing that record. So, only the
color does not change then, but the buttonvalue (pushed or not) does.
How to solve it?

Bart

Nov 13 '05 #3
"AA Arens" <ba***********@ gmail.com> wrote
Thanks for your input. It works wihtin
the record.
If it is in the AfterUpdate event, you can only expect the code to execute
when you take action on the OptionGroup.
However, when I move to the next
record, the color is not accoridng to
the value of the button, pressed when
passing that record. So, only the
color does not change then, but the
buttonvalue (pushed or not) does.
How to solve it?


Include similar code in the OnCurrent event (which fires when a new record
becomes the current one), assuming the Option Group is bound to a Field in
the RecordSource, so would actually have a setting.

Larry Linson
Microsoft Access MVP
Larry Linson
Microsoft Access MVP
Nov 13 '05 #4
I use more than two options, actually 7, resulting in a long VB script
(though it is working):
Can I make this script shorter? Like in the first two sections for the
Toggle 90 - 95, and for 89 + 91 - 95:

Private Sub Frame86_AfterUp date()
If Me.Frame86.Valu e = 1 Then
Me.Toggle89.For eColor = 255 'red
Me.Toggle89.Fon tWeight = 700 'bold
Me.Toggle90.For eColor = 0 'black
Me.Toggle90.Fon tWeight = 400 'normal
Me.Toggle91.For eColor = 0 'black
Me.Toggle91.Fon tWeight = 400 'normal
Me.Toggle92.For eColor = 0 'black
Me.Toggle92.Fon tWeight = 400 'normal
Me.Toggle93.For eColor = 0 'black
Me.Toggle93.Fon tWeight = 400 'normal
Me.Toggle94.For eColor = 0 'black
Me.Toggle94.Fon tWeight = 400 'normal
Me.Toggle95.For eColor = 0 'black
Me.Toggle95.Fon tWeight = 400 'normal
End If
If Me.Frame86.Valu e = 2 Then
Me.Toggle90.For eColor = 255 'red
Me.Toggle90.Fon tWeight = 700 'bold
Me.Toggle89.For eColor = 0 'black
Me.Toggle89.Fon tWeight = 400 'normal
Me.Toggle91.For eColor = 0 'black
Me.Toggle91.Fon tWeight = 400 'normal
Me.Toggle92.For eColor = 0 'black
Me.Toggle92.Fon tWeight = 400 'normal
Me.Toggle93.For eColor = 0 'black
Me.Toggle93.Fon tWeight = 400 'normal
Me.Toggle94.For eColor = 0 'black
Me.Toggle94.Fon tWeight = 400 'normal
Me.Toggle95.For eColor = 0 'black
Me.Toggle95.Fon tWeight = 400 'normal
End If

Etc..... (5 more sections follows)

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8685
by: Scott | last post by:
There is a setting in IE for "Print background colors and images." I've noticed that without checking this option, a web page will print CSS lines between table rows, but a background color of say the header won't. The below style will display the borders in print preview, but won't display the background color. Does anyone know if it's possible to force background CSS or HTML colors to print without having the user change the default...
14
5494
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
0
1320
by: Tom | last post by:
Hi I have a ListBox control of my asp.net web page. I want to set the value of the style property of the ListItem to a specific background color. I have tried this but no success: //li is the ListItem object li.Attributes.CssStyle.Add("BACKGROUND-COLOR:","blue");
8
10612
by: Grahammer | last post by:
Is it possible to set the background of a usercontrol as transparent? I tried setting the background image of the usercontrol to a transparent GIF, but that caused MAJOR problems. I'm making some controls that aren't rectangular and it won't be pretty if I end up with a grey rectangle behind each one. http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskGivingYourControlTransparentBackground.asp?frame=true
2
11796
by: frank.sconzo | last post by:
Greetings, I was testing my web application on the Mac/Safari and noticed a problem with the background color of the select input element. Safari doesn't seem to pay any attention to the style I set for the background color. The listbox ends up with a white background. It works nicely in Internet Explorer and I would like to make it work on Safari too. Perhaps I am doing something slightly non-standard, or maybe there is a
1
2112
by: Rich | last post by:
I have a simple vb2005 app (for testing). It is just a simple winform with one button that brings up a message box. When I invoke the app and click on the button, the message box comes up OK. When I click a button on the message box, the form and message box drop behind the IDE to the background. The exe does the same thing. What can I do to keep the app from dropping/falling to the background like that? Here is the code behind the...
8
3907
by: paul.denlinger | last post by:
Hi-- Things have gone well for me on this page design, but when I added a background image, it pushed everything down and messed up my page layout. Before I added the navigation background image, here is the CSS code: body { font-family:Verdana, Arial, Helvetica, sans-serif;
2
2893
by: sara | last post by:
Hi I'm having a very strange problem and need HELP!! I have a form for the user to choose a report (radio button in an option group) and parameters (Dates, Season). Click the option button, it turns Black, and the "On Got Focus" event fires. The event shows or hides the parameters appropriate for that report.
2
2310
by: John | last post by:
Hi I have a number of forms which open like this; Dim frm1 As frmForm1 = New frmForm1 Dim frm2 As frmForm2 = New frmForm2 Dim frm3 As frmForm3 = New frmForm3 Dim frm4 As frmForm4 = New frmForm4 .....
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.