Click here to Skip to main content
15,905,233 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
joshrduncan2012 19-Dec-12 14:29pm    
When B is selected, set all the others to be disabled?

1 solution

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

change it from...
Object.mulitple=true



to

Object.mulitple=false


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
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900