Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox Style and MultiSelect argh!!

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
I have a listbox on this form (VB6) which has been filled with records from a mdb and if i try to implement either:

listbox1.MultiSelect = True
or
listbox1.Style = 1

it gives me this error:
Compile error:
Can't assign to read-only property

Is there a way I can use eaither multiselect or style without errors.

Thanks.

 
Hi,

Multiselect and style is read only at run-time.
You can set the property at design time.

I don't know if there's a smart way around it, but one possibility is to have one list for each style you want and then make sure that only one is visible. Another is to set multiselect to 'Extended' (2) and then check that only one item is selected each time the user selects a new item (list1_click)...

Good luck,
:) Sunaj
 
Hi sunaj,

Thans for your advice. I would actually just prefer if my listbox could use: listbox1.Style = 1

setting listbox1 to 2 multiselect at design-time just swaps back to 0 at run-time.

do you think i would e able to change the style property if it were a datalistbox?
 
???
Are you saying that your listbox.multiselect changes value when you start your project? That should not be possible.

I don't know if datalistbox behaves differently -try it.
 
hi again sunaj,

Yes that's right, and it's sooooo frustrating, that I set it on multiselect 2 and when it runs it goes back to multiselect 0 because after you end it i can see it's back to 0. -very strange :)

i'll try the datalistbox and see if it's any different.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top