Listbox scroll operation gives duplicate rows.

S

Sanjay

Hi All,
I seem to have a very strange problem.
I have a button on the worksheet of the Excel.Upon
clicking the button I show a VB form which has a listbox
containing about 15-20 entries in it.To scroll through all
the contents of the list box I obviously have the scroll
button for the list box which comes by default.
I also have two buttons on the VB form for "MoveUp"
and "MoveDown" actions for the items in the list box.
The problem arises when I select a particular item in
the list and move it up or down in the list.
For Eg:Assume there are 10 items in the list.5 are
visible.To see the other 5 we have to scroll down.Now i
select item 2 in the list box and move it down the list
using "MoveDown" button.The operation works fine till it
reaches the 5th position in the box.Now when I move it
down again,the 6th item moves up and the 5th item
mysteriously displays the 6th item itself,ie,I have
duplicate values of the 6th item.If i use the "MoveDown"
again the original item moves down and displayed and the
operation happens properly.
This problem occurs only at first scroll of the list
box,ie .either up or down.
I tried reproducing the problem on a VB form but there
the operation happens fine.This is occuring only on Excel.
So I guess there is nothing wrong with the code and this
might be a problem with the display driver.
Any solutions or suggestions to this problem?

Thanks in Advance,
Sanjay
 
D

Dave Peterson

And I meant to say that when I clicked on one of those "bad" entries,
me.listbox1.value showed me what was really there--not what was displayed.
 
S

Sanjay

Hi Dave,
Thanks a lot for your suggestion.I followed the
workaround suggested by you and implemented this in the
code.
Now it seems to work fine.

regards,
Sanjay
 

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

Similar Threads


Top