ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBox Conundrum (https://www.excelbanter.com/excel-programming/412710-listbox-conundrum.html)

Nigel[_2_]

ListBox Conundrum
 
Hi All

I thought I knew how to manage UserForm listboxes. But clearly not !

On a user form I have a list box that is refreshed from another action. A
user can double-click an item in the list, which causes the list to be
reloaded, the number of items in the refreshed list may change but the item
that was double-clicked will remain but its position may differ.

I had set up some code that records the item chosen and then re-applies this
by setting the ListIndex to the right location. The value generated is
correct but the item is not being selected. It is as if the ListIndex value
is being ignored. The actual and wrong item selected is fixed by the
physical location of the original selected item in the list. Hope this
makes sense.

How do I eliminate the current selection before I reapply my new ListIndex
value? I tried setting the ListIndex to -1 first but that does not work.
Do I need to redraw or something else?

TIA



--

Regards,
Nigel





Bob Phillips[_3_]

ListBox Conundrum
 
Post the code.

--
__________________________________
HTH

Bob

"Nigel" wrote in message
...
Hi All

I thought I knew how to manage UserForm listboxes. But clearly not !

On a user form I have a list box that is refreshed from another action. A
user can double-click an item in the list, which causes the list to be
reloaded, the number of items in the refreshed list may change but the
item that was double-clicked will remain but its position may differ.

I had set up some code that records the item chosen and then re-applies
this by setting the ListIndex to the right location. The value generated
is correct but the item is not being selected. It is as if the ListIndex
value is being ignored. The actual and wrong item selected is fixed by
the physical location of the original selected item in the list. Hope
this makes sense.

How do I eliminate the current selection before I reapply my new ListIndex
value? I tried setting the ListIndex to -1 first but that does not work.
Do I need to redraw or something else?

TIA



--

Regards,
Nigel







Nigel[_2_]

ListBox Conundrum
 
Hi Bob
I have investigated further and abandoned this approach. It appears I
cannot fix this problem the way I have configured it.

Thanks for your reply

--

Regards,
Nigel




"Bob Phillips" wrote in message
...
Post the code.

--
__________________________________
HTH

Bob

"Nigel" wrote in message
...
Hi All

I thought I knew how to manage UserForm listboxes. But clearly not !

On a user form I have a list box that is refreshed from another action.
A user can double-click an item in the list, which causes the list to be
reloaded, the number of items in the refreshed list may change but the
item that was double-clicked will remain but its position may differ.

I had set up some code that records the item chosen and then re-applies
this by setting the ListIndex to the right location. The value generated
is correct but the item is not being selected. It is as if the ListIndex
value is being ignored. The actual and wrong item selected is fixed by
the physical location of the original selected item in the list. Hope
this makes sense.

How do I eliminate the current selection before I reapply my new
ListIndex value? I tried setting the ListIndex to -1 first but that does
not work. Do I need to redraw or something else?

TIA



--

Regards,
Nigel









All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com