检查在特定情况下,只能在列表框中选择一个字段 [英] Check that only one field can be selected in a list box when it is a particular case

查看:125
本文介绍了检查在特定情况下,只能在列表框中选择一个字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经列出了以下字段的列表框..:

A

B

C
D



现在我启用了多项选择,但我想要在用户选择B时禁用多项选择。

ie如果选择B则不能选择其他字段。



任何帮助都将被深深考虑。

提前致谢。

Hi I have made a list box with following fields..:
A
B
C
D

now i have enabled multiple selection,but i want that multiple selection should be disabled if the user selects B.
i.e If B is selected then no other field can be selected.

Any help will be deeply regarded.
Thanks in advance.

推荐答案

如果您使用的是服务器端列表框,请更改以下属性



If you are using a serverside listbox then change the following property

change it from...
Object.mulitple=true







to






to

Object.mulitple=false





但不要忘记检查B首先选择。





but dont forget to check that B selected first.

dim Test as boolean = False
dim Marker as integer

for i = 0 to Object.items.count - 1
  If object.items(i).selected then
    if object.items(i).text = "B" Then
      Test = true
      Marker = i
      Exit For
    end if
  end if
next
If Test Then
  For i = 0 to Object.items.count - 1
    Object.Items(i).selected = False
  Next
  Object.Multiple = False
  Object.items(Marker).selected = true
End If


这篇关于检查在特定情况下,只能在列表框中选择一个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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