Change MultiSelect property of ListBox during runtime

T

Tran Hong Quang

Hi,
I have a list box control. I set ListBox's MultiSelect = simple, which
allows user to select multiple values.

I want to allow user to change the list box to single select during
runtime. I set

listbox.MultiSelect = 0

It said that can not assign value to MultiSelect. I have a look on Object
Browser and found this property is read/write one.

How to change MultiSelect property of a listbox in runtime?

Thanks
Quang
 
B

Brendan Reynolds

The property is Read/Write, but only in design view.

To change the behaviour without changing to design view, you could use two
list boxes with different values for the MultiSelect property, and toggle
their Visible property.
 
D

Douglas J Steele

As it says in the Help file, "This property can be set only in form Design
view."

You'd have to switch the form to Design view, change the property, then
change the form view back. Note that this won't be possible if your user has
the Runtime version of Access (nor do I think it'll be possible in an MDE).
Why not simply introduce logic to tell your user when more than one item has
been selected?
 
T

Tran Hong Quang

I will follow suggestion of Douglas. I keep ListBox MultiSelect=simple (user
can select more than one item), just write small code to unselected the
previous selected item when user click another one.

Thanks
Quang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top