Hi I am new to the forum. I have created a form in Word 2007. I have implemented a radio button on the form. I want to add custom code so that every time the button is clicked, the color of the button changes. For example, I was thinking along the lines of a code that is similar to a snippet that I found on the web: - Private Sub OptionButton1_Click()
-
Option Explicit
-
Dim index As Integer
-
Dim indicator(5) As ColorConstants
-
-
Private Sub Form_Load()
-
indicator(0) = vbGreen
-
indicator(1) = vbRed
-
indicator(2) = vbBlack
-
indicator(3) = vbYellow
-
indicator(4) = vbBlue
-
-
End Sub
Can you please provde guidance for me?
Thank you.
Vickie
4 8257
This is changing the color each time the optionbutton is clicked. - Option Explicit
-
Dim indicator(5) As Variant
-
Dim index As Integer
-
-
-
Private Sub UserForm_Activate()
-
indicator(0) = vbGreen
-
indicator(1) = vbRed
-
indicator(2) = vbBlack
-
indicator(3) = vbYellow
-
indicator(4) = vbBlue
-
index = 0
-
End Sub
-
-
Private Sub OptionButton1_Click()
-
OptionButton1.BackColor = indicator(index)
-
index = index + 1
-
If index > 5 Then index = 0
-
End Sub
Hi Guido.
Sorry for the delay. Thanks a million for the code and of course it worked. However, once I launched the form I realized it was not what I had in mind. I apologize. I have a form with several radio buttons. I was able to get the background to change colors for each button. I actually wanted the circle itself to change colors. Should I upload the form so you can better visualize what I am trying to accomplish? If you work with me on the code for this once, I am sure that I will catch on and not need to keep coming back. I have some VB6 code for circles that I can also share with you. Let me know if I need to upload both for your review.
Vickie
Sorry. Ok I will remember to use tags for when uploading code.
Vickie
Please can you attach your code in Bytes?
You want to change the color of the button (the circle)it self?
Than it will not work with the standard radio buttons in VB6.
If so, we will have to create or own buttons!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jay |
last post by:
I have a form used to submit data (no surprises there!).
I'd like to be able to populate the same form with previously submitted
data.
The data lives in a database once submitted and using ASP I can populate
text boxes/textareas using this data no problem.
What about radio buttons?
If I have 2 of them named the same rb1 and rb1 with values of yes/no
respectively.
|
by: NishSF |
last post by:
Would anyone have any suggestions/javascript code so that if one clicks
the Radio Button "Yes" below he has the option of selecting any of the
six CheckBox below. If the user clicks on Radio Button "No", he should
not have the option of clicking on any of the six checkboxes. See Code
attached. Thank you so much in advance for your help as I can't get to
make this combo work.
<p>Did you have any problems finding any of the information...
|
by: kenny8787 |
last post by:
Hi, can anyone help here?
I have the following code generated from a database, I want to have javascript calculate the
costs of the selected items using radio buttons, subtotal the costs and grandtotal the costs
ready for the selected items to be inserted back to the database. I did something like this
before with Checkboxes, but Radio button have to be named the same to maintain their
groupings.
|
by: IchBin |
last post by:
I am trying to set the state of a radio button. I do not see what I am
doing wrong. Sorry, I am new at this.. I need another set of eyes to
look at this snip of code. I am trying to set the radio button with this
link of code:
echo 'SCRIPT language=JavaScript
setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //?
<snip of code>
|
by: IchBin |
last post by:
I am trying to set the state of a radio button. I do not see what I am
doing wrong. Sorry, I am new at this.. I need another set of eyes to
look at this snip of code. I am trying to set the radio button with this
link of code:
echo 'SCRIPT language=JavaScript
setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //?
<snip of code>
| |
by: swatidesai0407 |
last post by:
hi im validating radio buttons
i create dis radio button in php based on some how many records of my query.
i wrote a javascript to validate this buttons.
wat i do is dat wen no radio button are selected it should giv message dat select a radio button.
else it should go to other page.
My code works fine when there are more than 1 radio button
but when only 1 radio button is der dat time it does not work
|
by: Fran Jakers |
last post by:
Hello all,
I'm new to all this and I could really use some help. I've searched the web but cannot find an answer.
I have an HTML form with 3 radio buttons and a search field that calls a MySQL database using JavaScript to find a product either by Product ID, Description, or Both. Originally, the 'Both' radio button was "checked" but I now want the 'Product ID' button set as the default choice (as you can see from the code below).
...
|
by: jahphill |
last post by:
Hey.
I thought id make a seperate discusion because the other became a bit lengthy and confusing.
Aim:
Create a php file which works with the script below, which makes the radiobuttons work =D
Right, when say mp3 radio button is selected, and say BLA is typed in the text box. I would like it to open up...
|
by: johny10151981 |
last post by:
Hi,
Here a code part that create a group box and radio button
hGroup=CreateWindowEx(0,L"BUTTON",L"Choose Connection type", WS_CHILD|WS_VISIBLE|BS_GROUPBOX|WS_GROUP,30,180,300,85,hWnd,(HMENU)10006,hInstance, NULL);
CreateWindowEx(0,L"BUTTON",L"Direct Connection",WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, 10,17,280,30,hGroup,(HMENU) 10010,hInstance ,NULL);
CreateWindowEx(0,L"BUTTON",L"XML Connection",WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,...
|
by: Fary4u |
last post by:
how can i change radio button into image but functionality should be like radio button ?
.pic
{ background:url(pic.jpg) no-repeat; }
<input type=radio src=pic.jpg value=1 name=1>
or
<input type=radio class=pic value=1 name=1>
|
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...
| |
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,...
|
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |