只允许在集合中选中一个复选框 [英] Only allow one checked checkbox in a collection

查看:67
本文介绍了只允许在集合中选中一个复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我需要以编程方式允许或禁止在表单上选择多个

复选框。在某些时候我只想允许单个

选择,有时我可能希望允许多个。有没有办法吗?
这样做?


我不想用单选按钮.....


谢谢,


Jon。

Hi,

I need to programmatically allow or disallow the selection of multiple
checkboxes on a form . At certain times I only want to allow a single
selection, at other times I may wish to allow multiple. Is there a way of
doing this ?

I dont want to use Radio buttons.....

Thanks,

Jon.

推荐答案






" Bishman" < jo ************* @ btinternet.comwrote in message

新闻:O8 ************** @ TK2MSFTNGP02。 phx.gbl ...

Hi,

"Bishman" <jo*************@btinternet.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...




我需要以编程方式允许或禁止选择多个

表单上的复选框。在某些时候我只想允许单个

选择,有时我可能希望允许多个。有没有办法这样做?

我不想用单选按钮.....
Hi,

I need to programmatically allow or disallow the selection of multiple
checkboxes on a form . At certain times I only want to allow a single
selection, at other times I may wish to allow multiple. Is there a way of
doing this ?

I dont want to use Radio buttons.....



为什么不使用单选按钮?

用户希望通过无线电表示互斥选择

按钮而不是复选框。如果你不遵循这个规则你的界面将会很奇怪。

你可以通过检查复选框的状态或
$来做你想做的事情。 b $ b检查一个,如果检查另一个,则取消选中第一个。您可能会发现一个小问题,知道何时(状态的变化)是由您的代码或用户引起的。但是搞清楚这件事是有趣的部分

:)


Why dont use Radio buttons?
The user expect that a mutually exclusive selection be represented by radio
buttons not checkboxes. If you do not follow this rule your interface will
be weird.
You can do what you want by checking the status of the checkboxes, or the
one that is checked, if another is checked you uncheck the first. You may
found a little issue knowing when (the change of status) was induced by
your code or by the user. but figuring this out is the fun part of the thing
:)


是的,我认为这可能就是答案。


很多以前,当我做了一些VB4时,我认为有一种方法可以将

复选框分组,就像单选按钮一样?也许我的记忆在玩耍技巧

对我来说.....


我只是想知道今天是否有相同的内置功能(如果有的话) />
曾经!)


谢谢,


Jon。



Ignacio Machin(.NET / C#MVP)" < machin TA laceupsolutions.com写在

消息新闻:Oz ************** @ TK2MSFTNGP02.phx.gbl ...
Yes, I thought that may be the answer.

Many moons ago when I did a bit of VB4 I thought there was a way of grouping
checkboxs to behave like radio buttons ? Maybe my memory is playing tricks
on me.....

I just wondered if there is the same built in functionailty today ( If there
ever was ! )

Thanks,

Jon.


"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:Oz**************@TK2MSFTNGP02.phx.gbl...

>




" Bishman" < jo ************* @ btinternet.comwrote in message

新闻:O8 ************** @ TK2MSFTNGP02。 phx.gbl ...
>
Hi,

"Bishman" <jo*************@btinternet.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...

>

我需要以编程方式允许或禁止选择多个
复选框在表格上。在某些时候我只想允许单个选择,有时我可能希望允许多个。有没有办法做这个?

我不想用单选按钮.....
>Hi,

I need to programmatically allow or disallow the selection of multiple
checkboxes on a form . At certain times I only want to allow a single
selection, at other times I may wish to allow multiple. Is there a way of
doing this ?

I dont want to use Radio buttons.....




为什么不使用单选按钮?

用户希望相互独立的选择由

单选按钮表示而不是复选框。如果你不遵循这个规则你的

界面会很奇怪。


你可以通过检查复选框的状态或

选中一个,如果选中另一个,则取消选中第一个。您可能会发现一个小问题,知道何时(状态的变化)是由您的代码或用户引起的。但弄清楚这是

的有趣部分:)



Why dont use Radio buttons?
The user expect that a mutually exclusive selection be represented by
radio buttons not checkboxes. If you do not follow this rule your
interface will be weird.
You can do what you want by checking the status of the checkboxes, or the
one that is checked, if another is checked you uncheck the first. You may
found a little issue knowing when (the change of status) was induced by
your code or by the user. but figuring this out is the fun part of the
thing :)



根据您的要求,您需要禁用或启用复选框


Ignacio Machin(.NET / C#MVP)"写道:
Based on your requirements you need to disable or enable check boxes

"Ignacio Machin ( .NET/ C# MVP )" wrote:

>




" Bishman" < jo ************* @ btinternet.comwrote in message

新闻:O8 ************** @ TK2MSFTNGP02。 phx.gbl ...
>
Hi,

"Bishman" <jo*************@btinternet.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...




我需要以编程方式允许或禁止选择多个

表单上的复选框。在某些时候我只想允许单个

选择,有时我可能希望允许多个。有没有办法这样做?

我不想用单选按钮.....
Hi,

I need to programmatically allow or disallow the selection of multiple
checkboxes on a form . At certain times I only want to allow a single
selection, at other times I may wish to allow multiple. Is there a way of
doing this ?

I dont want to use Radio buttons.....




为什么不使用单选按钮?

用户希望通过无线电表示互斥选择

按钮而不是复选框。如果你不遵守这个规则你的界面将会很奇怪。


你可以通过检查复选框的状态或

选中一个,如果选中另一个,则取消选中第一个。您可能会发现一个小问题,知道何时(状态的变化)是由您的代码或用户引起的。但想出这个是有趣的部分

:)



Why dont use Radio buttons?
The user expect that a mutually exclusive selection be represented by radio
buttons not checkboxes. If you do not follow this rule your interface will
be weird.
You can do what you want by checking the status of the checkboxes, or the
one that is checked, if another is checked you uncheck the first. You may
found a little issue knowing when (the change of status) was induced by
your code or by the user. but figuring this out is the fun part of the thing
:)


这篇关于只允许在集合中选中一个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆