#ListItem Disable/Enable
5 messages in this thread
I've been trying to set a listbox item from enabled to disabled and can't
seem to get it. The idea here is, after the user selects an item I want to
disable the selected item, leave it in the box but change it to disabled so
the user can NOT select it again.
Any ideas ??
Thanks
There is 1 Reply.
Mike,
About the only way to do this is with an array that indicates which
elements in the list box have been selected. Fill the list box, then create
the array:
x = listbox.listcount
dim z(x-1) as integer When an item is selected:
x = listbox.listindex
if z(x) then
'this item was previously selected
else
z(x) = true
'process a first time selection
end if
–dennis
There is 1 Reply.
Dennis, I've gotten as far as you suggested (the array idea) but I've
haven't found a way to set the enable / disable property for a list item.
The workaround I choose was to have an array of all the items in the list
and delete each item from the list as it is selected. Upon completion of
the routine I then read the array back into the list and there's the list
back again.
Is there any way that you know to set the enable / disable property of a
list box item? Thanks
Mike
There is 1 Reply.
Mike,
Actually, at first glance, I like your method a lot better than mine. If
an item isn't even in the list box anymore, it's sure tough to try and
select it. <g> Also seems to be simple to do. Great idea.
–dennis
There is 1 Reply.
Dennis, Thanks, it does work but it would be nicer if I were able to
disable the list item. If nothing else exists, I think I'll write a DLL
routine to accomplish this.
Thanks for the information, talk to you again sometime.
Mike