473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

Radiobutton logic ? How to implement auto unchecking others in panel

Hi

I am creating a custom control and i want it to behave like a radiobutton :

If multiple radiobuttons are on a panel clicking one unchecks the others.
How is this achieved ?

I want to do the same with my own control when i put multple of them on a
panel or groupbox.

Johan

Feb 15 '07 #1
4 5229

In a web form or win form? Makes a big difference in the answer...

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.


On Thu, 15 Feb 2007 14:35:40 +0100, "Sagaert Johan"
<RE*************@hotmail.comwrote:
>Hi

I am creating a custom control and i want it to behave like a radiobutton :

If multiple radiobuttons are on a panel clicking one unchecks the others.
How is this achieved ?

I want to do the same with my own control when i put multple of them on a
panel or groupbox.

Johan

Feb 15 '07 #2
Win form

"Samuel R. Neff" <sa********@nomail.comwrote in message
news:e3********************************@4ax.com...
>
In a web form or win form? Makes a big difference in the answer...

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.


On Thu, 15 Feb 2007 14:35:40 +0100, "Sagaert Johan"
<RE*************@hotmail.comwrote:
Hi

I am creating a custom control and i want it to behave like a radiobutton
:

If multiple radiobuttons are on a panel clicking one unchecks the others.
How is this achieved ?

I want to do the same with my own control when i put multple of them on a
panel or groupbox.

Johan

Feb 15 '07 #3
On 15 Feb, 13:35, "Sagaert Johan" <REMOVEsagaer...@hotmail.comwrote:
I am creating a custom control and i want it to behave like a radiobutton :

If multiple radiobuttons are on a panel clicking one unchecks the others.
How is this achieved ?
Try simply inheriting from RadioButton. I've just tried that now, and
it seems to work fine. If I place two of my new controls on the form,
then only one can be selected at once.

Feb 15 '07 #4

That's good, winforms is easier for this question. :)

When you click a winform radiobutton (or set it's checked property to
true) it loops through all sibling controls (i.e., children of it's
parent) and for every radio button it finds that isn't itself it
unchecks it. Pretty straightforward. You can use Reflector to look
at RadioButton.PerformAutoUpdates for exactly what it does.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Thu, 15 Feb 2007 15:53:46 +0100, "Sagaert Johan"
<RE*************@hotmail.comwrote:
>Win form
Feb 15 '07 #5

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

Similar topics

2
by: Mike | last post by:
I've placed a radiobutton on a green panel. The background of the radiobutton is also green. Borderwidth is 0 and relief is FLAT. I still get a thin gray border around the radiobutton. What is...
3
by: jahuer1 | last post by:
On my Form I have several Panels with several RadioButtons on it. When I start the Form, on each Panel a RadioButton should be selected if it was selected when I called the Form some time ago. ...
2
by: Jerry | last post by:
Hi, I just found out that when I check a raidobutton TWO things happen. The CheckChange event is fired for unchecking the checked button and another is fired for the new one to become checked....
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
5
by: Matt B | last post by:
I know this is a bit of nonstandard behavior, but I would like the Enter key to move focus through a group of radiobuttons without selecting them. The user would then have to use Space or actually...
2
by: Chris Zopers | last post by:
Hello, I would like to know what's the best way to implement a business logic layer between my user interface and my database. I would say I'd make a dll-project for the business logic layer...
5
by: BillE | last post by:
I am using VB.NET, VS 2005 Add a windows form and in design view: Add a Radiobutton to the windows form Set AutoSize = True for the radiobutton Set the MaximumSize width to 90 for the...
0
by: watashi | last post by:
Hello, I want a form with panel exhibits auto hide functionality similar to VS2005. i.e when the mousehover the toolbox main area contents get hidden behind the toolbox. When the button...
1
by: pravinnweb | last post by:
can anyone tell me how to set auto height to outer div that is in green box id "gray-background" it should increase relatively to inner div "smbox" here is the css and html code it should work in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
tracyyun
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...
0
isladogs
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...

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.