User Control with option button

I'm creating a user control with an option button but when I add two instances of my control to a form I can select both. How can I make them exclusive?
I tried the OLE_OPTEXCLUSIVE standard data type and I make the value property the default property with no results.


Tanks in advance.
portugaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

phutsonCommented:
To make an option buttons exclusive they must be in the same frame or same form. If you have the option buttons in seperate frames they will not exclude each other. With that said how is the form layed out?
0
portugaAuthor Commented:
I have the two controls in the same Tab.
The problem is that the option buttons don't be exclusive it they are inside a user control.
0
phutsonCommented:
Have you tried drawing a frame around them in that tab>

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

portugaAuthor Commented:
Yes, and I can select both anyway.
0
phutsonCommented:
I probably should have asked this first but what version of vb are you using.

0
portugaAuthor Commented:
VB5 with SP3.
0
phutsonCommented:
First thing I have to apologize I didn't realize what user controls were. Now a crude way of doing what your asking maybe to add code to the click command (if its available) to unselect the other options in the control. Maybe someone else can offer a more realistic solution or I might still find it I'm still looking.


0
chris_aCommented:
This might be beyond VB, I believe the groups are set up when the window (control) is created by setting the the WS_GROUP flag for the first control in each group. I would guess you need to remove it from the 2nd control, and whether it would work after creation is unsure.

It might be possible with VC to subclass the option button and modify the window creation but it all sounds more trouble than doing it in the click event.

Of course this is all theory and could be complete BS

0
flivaudaCommented:
This is very easy.  Create a new project active-x control.
Then add a frame, now add to radio buttons save your control.
add another project drop two instances of your control onto the new form then run it and you should be able to select either button on either control.

Now if your custom control is a single option button (which I dont really understand the point of) of course you will be able to select both of them at the same time.  They are completly different controls and not tied to each other at all.  Tell me more the purpose of this control and i can help you more.  If you want to have X amount of option in yur frame you can cod ethe control to do that but I don't see the value in a control that is just a radio button.
0
portugaAuthor Commented:
I realy want to make a user control with a single option button, because I want add some properties.
0
bin_huwairibCommented:
portuga,

Add option button (option1) to a user control (usercontrol1) then paste the following code in the UserControl1:

Sub ResetOptionButton()
 Option1.Value = False
End Sub

Private Sub Option1_Click()
 Dim MyControl As Control

 With UserControl.Parent
  For Each MyControl In .Controls
   If TypeOf MyControl Is UserControl1 Then
    If UCase(MyControl.Name) <> UCase(UserControl.Parent.ActiveControl.Name) Then
     Call MyControl.ResetOptionButton
    End If
   End If
  Next
 End With
End Sub


Best Regards
Bin Huwairib
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.