Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Excel VBA Radio Buttons


In Excel, there are apparently two types of form controls that can be used. There are controls on the Forms Toolbar and there are also ActiveX controls.

I am trying to use radio buttons. Apparently the ones from the Toolbar simply put a value in a cell of the spreadsheet when selected. Any VBA written must evaluate the cell. VBA cannot directly evaluate the control. The activeX control can be manipulated directly from VBA.

Am I correct in this understanding?

Thanks in advance.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
[Excel-VBA] Form With Check And Radio Buttons
How do I get this form with its functionality into Excel with VBA code?

Radio Buttons + Drop Down Buttons.
Hi guys I have a simple program that when a user fills in a text box and then presses a command button it copies the text from text1 to another text "form" ..

now I have not used radio or drop down buttons I am sure its VERY simple .. but how to I do it so that when a radio button is checked it will do the same as the above as in copy it once a certain one is checked.

I am also looking for the same answer for dropdown menues.. once a certain once is selected it will copy it into a text box..
but with th drop down menu I also want once extra thing.

And my last question is I would like to know how, once a user selects a radio button "only one of them not for all" it will pop up a textbox asking for user input on the form.. for example
radio 1 (apples), radio 2(orage) radio 3 (specify) thanks for all the help..

Nelson

Radio Buttons
Im making a testing program...Im trying to use radio buttons for a series of multiple choice questions, In which there is no right answer. so the first choice always has a value of 0, the second has a value of 1, etc.

Right now im using a option_click subroutine to add points to a total, but if the user clicks on a choic then changes their answer, the previous points are still added. Please help!



Code:
Dim total As Integer
Dim i As Integer
Dim x As Integer
Dim question(0 To 19) As String
Private Sub bnNext2_Click()
scorePage1.Caption = total
End Sub
Private Sub Form_Load()
total = 0
Open "C:Documents and SettingsMy NameDesktopVB est.txt" For Input As #1
Input #1, question(0), question(1), question(2), question(3), question(4), question(5), question(6), question(7), question(8), question(9), question(10), question(11), question(12), question(13), question(14), question(15), question(16), question(17), question(18), question(19)
For x = 0 To 19
lblQues(x).Caption = question(x)
Next x
End Sub
Private Sub opt2_Click(Index As Integer)
total = total + 1
End Sub
Private Sub opt3_Click(Index As Integer)
total = total + 2
End Sub
Private Sub opt4_Click(Index As Integer)
total = total + 3
End Sub

Radio Buttons.
I have a control that asks multiple choice questions. When a user clicks on a radio button (one of three) it gets focus.

The problem is that when the next question is loaded, the clicked radio button still has focus.

Is there a way to unselect all 3 radio controls? I hear there isn't. Would it be possible to make a 4th control and keep it invisible? I tried the following but wanted to make sure that it wasnt just operator error.


Private Sub qOption_Click(Index As Integer)
If Index < 3 Then
Dim SelectedAnswer As Integer
SelectedAnswer = Index '(Integer)
Let Response = Index '(Property declare, updates control property)
If Answer = qOption(SelectedAnswer).Caption Then
Call UserControl_CorrectAnswerSelected
Else
Call UserControl_WrongAnswerSelected
End If
End If
End Sub


Okay the reason for the less than 3 is so that it only checks the answer when the first 3 controls (0 to 2) are clicked.

Here is the code I put in the button that requests the next question. qOption_Click (3) is supposed to click the control that isn't visible.

Private Sub cmdNext_Click()
qOption_Click (3)
RaiseEvent NextQuestion
End Sub


Any suggestions on how to do what I need to do?

Radio Buttons
i am writing a quiz program.

GUI
__________________________________
lblQuestion

---------FRAME----------
radAnswer1
radAnswer2
radAnswer3
-------------------------

cmdOK lblCountScore
___________________________________

This is my code:

Dim countScore As Integer

Private Sub cmdOkay_Click()
If radAnswer1.Value = True Then 'radAnswer1 always right answer
countScore = countScore + 1
lblCountScore.Caption = countScore
Call Question2
Else
MsgBox ("Wrong Answer!")
Call Question2
End If

End Sub

Private Function Question2()
lblQuestion.Caption = "This is question 2"
radAnswer1.Caption = "answer1"
radAnswer2.Caption = "answer2"
radAnswer3.Caption = "answer3"
End Function


the problem with that is that always when i want to call a new question, the right answer must be radAnswer1. can i change that?

Radio Buttons
how do i group radio buttons, so that i can only pick one out of three?

GUI

lblQuestion

Radio1
Radio2
Radio3



the radio buttons are the answers of the question. user should only be able to check one button

Radio Buttons
hi, sorry for all the nooby questions

i have 5 forms, 4 radio buttons in each, there is 1 question on each form, if the correct radio button is selected it is ment to open the next form, same thing to the end, if the wrong radio button is slected then a vbokonly error msg is to appear then return back to the form

VB Code:
Private Sub CommandButton1_Click()If OptionButton2.option = True ThenShow UserForm2.formElseMsgBox " Wrong", vbOKOnlyend


i having a bit of trouble, as im linkthing this in word, a command is in word, ment to bring thr forms up in word, like a pop up, but when in visual basic and i press play it comes up the macors are disabled, how do i turn them on or make this work, also would that code work or is it close?


thanks for all the help

Radio Buttons
You know, those little buttons that are like check boxes, but you can only select one. (I think they are called 'radion buttons'. Please correct me if I'm wrong.)

Anyway, I'm having trouble with them.
Can someone tell me how to do them?

Thanks!!

Radio Buttons
Is there a way to have a few radio buttons (6 for example) but only have 1,2,3 working together and 4,5,6 separate from the first three? So I could have button 1 and button 5 checked on the same form?

Thanks

Radio Buttons
Hello everyone. This may be a simple one and I'm just pretty stupid, but in a program I am developing, I WOULD like to use radio buttons for a database record. I am using Sheridan 3D controls. How would I go about doing that?

Example:

Radio options are:
Blue
Red
Green

If Red's value was TRUE, how would I get RED to show in the record? MS ACCESS is being used. I've been programming my WHOLE LLIFE and I guess since I haven't done Windows Databse programming in a while, it sorta wore off. THANKS!!!!!

Radio Buttons
I have a form with radio buttons.

How do I keep the radio buttons clicked when hiding then reopening the form?

I know I have to save the info at the module level. I can get textboxes to remain populated with info, but what about a radio button?

Thanks!

Radio Buttons
hewwo...

You know how in HTML you can make different "groups" of radio buttons, so you can only choose one option in each group..


how would i do that in VB? I don't see any "group" option or anything under the properties...thanks


-nabeel

Radio Buttons
Hi ppl,


I'm trying to do a form, like questionnaire.. where i'll have a series of questions with columns of radio buttons next to them so people can select say for example good, average or bad.

Problem is after selecting one for the first question selecting one for the second question erases the first selection (take the dot out of the first row)..

Please help as I can't understand it...

THANX IN ADVANCE !

Housey

Help With Radio Buttons, Please!
Hi everybody! does anyone know how to create dynamic radio buttons? i need to display a list of choices from a database, but i don't know how to determine the number of buttons and assign 'em values during run time.

Thx all

Radio Buttons
What is the code used with Radio Buttons to determine which one is chosen?

This would make sense to me, obviously wrong though.

If Option2.Clicked = True Then
Label1.Caption = "Option2"
End If

Thanks

Radio Buttons
Does anyone have an example of scripting a series of radio buttons??? I have been looking on the internet for a start and have not found one.

I have a button on a Form...when clicked I want another box to open with three Radio (Option) buttons. Upon selection it will run one of three different sets of code.

I just need a start to create the little window with the radio (option) buttons....

Thanks

Radio Buttons In VB6
Hello everyone, I am trying to use radio buttons for male and female in VB6 form but don't know how to do it. the two radios should have the same name and for male the value is 1 and for female the value is 2. It's easy to do this in a web form, but in VB form looks like the radio can't have the same name...

thanks a lot!

chris

Radio Buttons?
I'm new to VB6. I was an old dBaseIV programmer. I am studing from 2 Sams VB6 books. I have set-up my project forms as SDI's. Each form is a menu of some sort. A Main Menu, then to a database update, change data, delete data, printing, etc. the usual stuff. To move between forms with Radio button controls.
I have the Main Menu form working and am able to move to the next form. I want to remove the dot from the center of the Radio Buttons when the form shows, so the user has to make a choice. But when I do this it looks like I fall through the code until I hit an End command and the program quits on me. Is there a way to do this?
I would like to have an Ok button to click on after the user has made the Radio Button choice, but when I click on the button I go right to the next form. Do I need to set-up a loop and case and end case inside the loop to do this?
I hope this makes sense?
Thanks in advance, Ralphie

Radio Buttons Help Please
Hi , I am running VB6, I have a form with a button called Compile on it and two radio buttons, and 5 text boxes. The user puts info in the text boxes and uses the radio buttons to choose what calculations he wants done based on his choice of radio button. He then clicks compile button and the calculations are done and the answer displayed in one of the text boxes. How do I get it to calculate only that choice? I am new to this stuff so please be precise.


Code:


______________________________________________
Option Explicit
Dim arvac As Integer
Dim grey As PaletteModeConstants
______________________________________________

Private Sub Option1_Validate(Cancel As Boolean)
If Option1 = True Then
Text3.Enabled = False

End If
End Sub
______________________________________________


Private Sub Command1_Click()


'Radius of a Curve
'R = (C² / (8 * m)) + (m / 2)
'R = (4²/(8*3))/(3 / 2)
'R = 16# / 24# + 1.5
'R = 0.67 + 1.5
'R = 2.17
'The radius of the curve is 2.17 feet

'Critical Speed of the Curve or Vehicle's Center of Mass
's = 3.86 * Sqr(R * (f±e))
'S = 3.86 * Sqr(2.17 *(.45 ± 2))
's = 3.86 * Sqr(2.17 * (2.45))
's = 3.86 * Sqr(5.31)
's = 3.86 * 2.3
's = 8.89
'Critical Speed of the Curve is 8.89 MPH

Text3.Text = Val(Text1.Text) ^ 2 / (Val(Text2.Text * 8)) + ((Val(Text2.Text) / 2))
Text6.Text = 3.86 * Sqr((Val(Text3.Text) * ((Val(Text4.Text) + Val(Text5.Text)))))


End Sub
________________________________________________

About Radio Buttons
In my Vb Form i am having 3 radio buttons, now in the form load event i m
setting th value of all the radio buttons to false.
still when i am running the form it is showing one radio button selected. i don't want any button to be selected unless user clicks on it.
help me
thanx 2 all

Radio Buttons
I have 3 radio buttons inside a frame...Option1, Option2, Option3. When the form loads i want to have the Option1 button selected when the window opens.
anyone know how?
Thanks,
Eldron

About Radio Buttons
Dear all,

I have two frames consisting of two radio buttons each.My question is.Suppose if i check one radio button of any one frame the othe two radio buttons of anothe frame should be disabled.and vice vwersa.Can any body give the code for it .it is very urgent.Pls help me.

Thanks

Naveen

RADIO BUTTONS AND ASP
Excuse my ignorance on this subject:

I am looking for a way to check to ensure a radio button on a web page is selected (in other words I have 2 radio buttons, of the same group, and one needs valued)...I want to do this on the client side. for a text box, I just check the .value property, but it doesn't seem to work for a radio button. If anyone can help, please do!

Thank you.

Question About Radio Buttons
Here's the situation:

I have a tabbed pane with 2 panes. In each of the panes, there are 2 radio buttons. I clicked on 1 radio button on the current pane, switched on the other pane, and clicked on another radio button. When I switch back to the first pane, the shade on the radio button that I have clicked a while ago has disappeared. But I wanted to have that shaded radio button to be still shaded. I used <RadioButton>_Click() already.

How can I solve this?

Thanks...

2 Sets Of Radio Buttons???
should be simple..
i have 2 option buttons on my form for male and female... a few lines down i want to add 2 more option buttons for yes and no... right now all four option buttons act together.. as in i cant select male and yes... is there a way to "seperate" the sets of radio buttons.
thanks

Radio Buttons Help Needed!!
I'm a Newbie who has a problem with radio buttons. I have a main form with four radio's down the left side. How can I allow a user to select one, click a command button(OK) and from there be taken to a second form for further instructions??

Validating Radio Buttons...
its like..i have 2 radio buttons in a group box..how do i make sure they check either radio button..? for example: if they didnt check either of them..then error message will appear

Radio Buttons Checks
I'm fairly new to programming, started about 4 months ago.

So, say I had a quiz consisting of 5 questions and 4 options per question, therefore I have arrays for radio buttons as so:

Option1(3)
Option2(3)
Option3(3)
Option4(3)
Option5(3)

Now, I have randomly chose my questions using this code:


Quote:





questionNum(0) = Int(Rnd * 20)
lblQuestion1.Caption = question(questionNum(0))
For X = 0 To 3
Option1(X).Caption = answer(questionNum(0), X)
Next X






Now, I have a button that will check the answers, and rather then having a BUNCH of IF statements like:


Quote:





For X = 1 To 5
If question(0) = lblquestion(X).Caption Then
If option1(1).Caption = answer(0, 0) Then
answer1 = "Correct!"
ElseIf option2(1).Caption = answer(0,0) Then
answer1 = "Correct!"
End if
End if
Wend






Is there a more simple way to go through this procedure? I tried this:


Quote:





For X = 1 To 5
If question(0) = lblquestion(X).Caption Then
If optionx(1).Caption = answer(0, 0) Then
answer1 = "Correct!"
End if
End if
Wend






But that does not work. If anyone has a more simple code, then please let me know! Thanks!

François

2 Groups Of Radio Buttons ?
Hello,

When I use search , to find the above topic , I can see they tell me to use a frame around the button group.

If I use this idea , the Frame stay on top of my buttons , and I can not see the buttons

Do you know what I do wrong ?

Best Regards,
Didier.

XP Styles And Radio Buttons
How do I get radio buttons that are on frames to display correctly when using the XP styles manifest. When I made my own example, the background is drawn incorrectly for radio buttons on frames, but I have other examples that I compile that show radio buttons on frames that are drawn fine...but if I add my own radion button (copy of working control), that control will draw incorrectly. What is going on here?

Creating Radio Buttons On The Fly
hi,
i have 5 radio buttons..........based on the button clicked i have to create some radio buttons on the fly..........how can i do.......can someone gimme a small example?

thanks

regards
vivek.s

Multiple Radio Buttons
can someone pls tell me how to handle 8 radio (True/False) buttons being related to 4 questions and getting a feedback through one control in one form. A sample is attached.

Transparent Radio Buttons - PLEASE HELP
I'm trying to make a radio button transparent and here's what I have so far:


VB Code:
picCONTAINER.ScaleMode = vbPixels    For lXPos = 0 To RADIO.Width Step 1        For lYPos = 0 To RADIO.Height Step 1            lColor = GetPixel(RADIO.DC, lXPos, lYPos)            If (lColor <> vbBlack) And (lColor <> vbWhite) And (lColor <> 8684164) Then                 BitBlt RADIO.DC, lXPos, lYPos, 1, 1, picCONTAINER.hdc, RADIO.Left - 1, RADIO.Top + lYPos, vbSrcCopy            End If        Next lYPos    Next lXPos


This works with the exception of flickering and if I bring up a window OVER the form and then show the form again, the radio button is back to normal. I'm assuming if I put the code in the PAINT event of the container that this would fix the latter, but wouldn't this be too slow? Any better solutions to ANY of the above? THANKS!

Radio Buttons Messages
Hi all,

Does anyone know the messages sent between a container and it's radio buttons so that radio buttons are exclusively set?

I am trying to create an OCX control with similar functionality.

Regards

Chris

Coding For Radio Buttons
What type of coding do I need to use to make pricing appear in the text boxes to the right of the radio buttons? The form is attached!

Help With Frame && Radio Buttons
I have 3 Frames each has four radio buttons. If I select 1 radio button from each, how do i display them as msgBox? and how do I code msgBox to say Ok or Cancel? Thanks
Sarah

How To Group Radio Buttons????
Hi!

I have this problem with radio buttons on my form. I have this form that asks
users 5 questions and the user selects the radio button to respond to the question.
The problem is that the answer to the question doesn't stay selected. When the user
answers the first question and moves on to the second question the answer
to the first question is gone and it doesn't stay.

Why? What do I have to do to get the answer to stay for all questions?

Do I have to use an array or something? How do those work? If I use an form and
group the radio buttons, how do I do that? Is there a way to group in code?
Must I use a frame?
I have tired a form with the radio buttons and get the same problem. I have tired
frames and get the same problem ? Why?

Is there any way to make the frames invisible so that it looks like all of the questions
are on form/frame?

Example:
1. Rate our Food: 1 2 3
...
5. Rate Our Service: 1 2 3
I'm Uisng VB 6.

Thanks for any and all help!!

Option (Radio) Buttons
hello,

I'm using VB6. I've got 5 option buttons in a form. What should I do so that the user can only take one option at a time? i.e. the other four options will automatically uncheck when user checked one option. Thanks!

Resetting Radio Buttons...
I have a form that has 3 radio buttons that a user can use to if they want to retrieve data (by description or stock #, or by page #).  Purely optional. If neither of them are selected (as when the form first loads) then the default retrieval is to retrieve all.  They would like a "Reset" button, in case after they select one radio button, they can change their mind and have them all cleared (to retrieve all)....but it appears once one is selected, all of them cannot be reset without resetting/reloading the entire form...

Just wanted to make sure that is the case or if there is a way I can accompish this...since there are other controls on the screen that I do not want to have reset with a reload of the entire form.

Thanks!

Radio/Option Buttons
I come from a WP shop and we're moving to Word 2000 (i think) in July. I have until then to recreate all of our WP templates with custom dialog boxes to Word templates wtih custom user boxes. I have been working on this for 6 days now, and much to my surprise, I have successfully created 3 templates with user boxes (text boxes for user input only) and they actually work! Now I need to create a user box with two radio/option buttons to indicate gender and I am not sure how to do it.

In WP, I would put a bookmark in the doc and then in my macro code I would do a Bookmarkfind and an If statement. In Word VB, I don't know what to do. I tried putting the bookmark in the doc, but I'm not sure how to code it. Can someone please point me in the right direction. Thanks in advance.

SSTab And Radio Buttons
I have an SStab with three tabs. The first tab (0) has text boxes enclosed in a frame for data entry by the user. The second tab (1) also has text boxes enclosed in a frame for data entry by the user, and another frame enclosing three radio buttons (options). The third tab (2) displays the reults of the calculations based on the data entry in the previous tabs. The data entry works fine, and I get the results to display correctly, however, when tabbing through the text boxes, moving to the second tab Ok, the option buttons are ignored. i.e. the cursor completely passes the radio buttons by. Any idea why? How can I get the radio buttons to be selectable? Any help greatly appreciated.

If Then Statements With Radio Buttons
I have a form with a radio button and What I want it to say is that when a certain field equals 0 then the radio button should be unclicked but when there is any other value then the radio button is clicked... I am using access so I am not sure if this is an appropriate area to be posting.

the field I want to look up is called 'Effective' in a query called 'Master'

and even better, If on the form the button is clicked, I would like it to update the tables which feed the query, if that is possible.



Edited by - taosd on 8/19/2003 8:15:25 AM

Dababases And Radio Buttons
Good day,

   I am looking for the simplest way to use radio buttons tied to a database. Basically what I am trying to do is this:

 I have a database which has a field that could have 3 possible values. S, O, or N. I would like to give the user the option to select this field from 3 radio buttons. However I have never worked with radio buttons that would eventually save to a databases, and vice versa be read from a database.

  I have the rest of the fields tied to an ADODC control, so I would like it if at all possible that the radio buttons somehow be tied to the same control. If someone has an answer to this please let me know. Thank you.

Bryan

I Need Help With Radio Buttons And Frames
i use with my apps an *.exe.manifest file that enables xp-style appearance when my apps run in XP environment.
but when i run my apps in XP environment all the radio buttons on any frame appear black but when
i place them on a form they appear just fine. is there any way to correct this??

please help me

thanks in advance



Edited by - SledgeHammer_999 on 7/19/2004 3:20:21 PM

XP Look Of Radio Buttons Failed
I have advised Windows XP with a xxxx.exe.manifest file (simply copied from messenger) to display the controls of my VB application with the XP skin .

All works fine, only the radiobutton is displayed black on black

Can someone help me?

Radio Buttons At Run Time
Hi

Am developing a project in VB, want to know if there is a way by which i can create radio buttons at run time. All i want to do is querry a database and depending on the records want to create radio buttons equal to the number of records returned by my querry.

How do I do that? An early reply/suggestion would really help

Thanks

Selecting Radio Buttons In Forms
There is a Webpage that has two radio buttons with the values "1" or "2". Using Webrowser1 I can seem to have in Value 2 or the second button seleted. The first button is selected on default. I've tried the following with an error of "Object doesn't support this property or method":

.Document.All("ListingScheduledOption").Value = "2"
.Document.All("ListingScheduledOption").Value = 2
.Document.Forms(0).ListingScheduledOption.Value = "2"
.Document.Forms(0).ListingScheduledOption.Value = 2

The following does work but the element number in the webpage is not always the same so it can't be used consistantly:
.Document.Forms(0)(21).Click

Any idea of what may be wrong?

TIA,
Tony

Radio Buttons In Menu Bars?
Am I dreaming or is it possible to create radio buttons in a menu bar, I am sure I have seen it done somewhere before?

Can anyone say yes or no?

Simple Question About Radio Buttons
I am trying to put like 5 sets of Yes/No radio Buttons on my form, each set having a different control name and they are indexed, for example:

optYesNo1(0)
optYesNo1(1)

optYesNo2(0)
optYesNo2(1)

etc...

However, it seems that I can still only have 1 value = true even though I have 5 different indexed controls. How do I get around this so that I could have all 5 buttons set to No?

Copyright © 2005-08 www.BigResource.com, All rights reserved