Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Caption of Command Buttons in Option Group 1

Status
Not open for further replies.

cP6uH

Programmer
May 21, 2003
17
0
0
CA
Hi,

Is there a way to get a caption of pressed command button in an option group.
So what I have is Option Group with let's say 4 options, and they're all command buttons. So, when user selects one, and clicks some other button to run some code, I'd like to get the caption of the option selected.

Is there a way to do that ??

Thank you,
Dragan
 
msgbox me.control(?).caption

will show the caption of the ? th control

rollie@bwsys.net
 
How do I find out what is the number of the selected control ?
 
do a

do an onclick event on the control and
enter

msgbox me.name

I am not sure about this but believe it will work. Send me your email address and I will send you an example


rollie@bwsys.net
 
Thanks a lot Rolliee, with your help I produced a code that works.

Here's the code if anyone ever needs to do something like this.

Dim i As Integer

For i = 0 To Me.Controls.Count - 1
If Me.Controls(i).Name = "Frame Name" Then Exit For
Next

MsgBox Me.Controls(Me.[Frame Name] + i + 1).Caption



Dragan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top