Listview control won't scroll fully

J

John Dann

I have a listview control on a simple vb.net form that's populated
programmatically. It is set to scrollable and a scroll bar duly
appears. However the scroll bar doesn't allow the bottom rows of the
list to be seen.

For example, if I have 31 rows in the list with the control set to a
height that shows maybe 20 rows then the scroll bar allows me to get
down to eg row 28 as the bottom row, but not row 31. Yet if I drag the
bottom of the form to allow the listview control more height then all
31 rows are there. So it seems like the control is being fully
populated as expected, but the bottom few rows are simply not visible
when the listview is not allowed full height.

This is all a bit odd in that the scroll is sort of working but not
completely. Anyone have any idea what I might be doing wrong please? I
have the listview anchored top and left but I'm not sure why this
should make any difference?

JGD
 
H

Herfried K. Wagner [MVP]

* John Dann said:
I have a listview control on a simple vb.net form that's populated
programmatically. It is set to scrollable and a scroll bar duly
appears. However the scroll bar doesn't allow the bottom rows of the
list to be seen.

What 'View' did you select for the control?
 
J

John Dann

However the scroll bar doesn't allow the bottom rows of the
list to be seen.

OK, I've seen the problem - I had the listview height set to a larger
value than the form height. But this arose because being newish to
..net I couldn't quickly see a way in vb.net to do:

listview1.height=me.scaleheight

which I would have done in VB6 in order to make the control fill the
form area. I'm obviously missing something simple here, but what is
it?

JGD
 
J

John Dann

But this arose because being newish to
.net I couldn't quickly see a way in vb.net to do:

listview1.height=me.scaleheight

which I would have done in VB6 in order to make the control fill the
form area. I'm obviously missing something simple here, but what is
it?

Sorry for answering my own question a second time, but some more
digging shows that:

listview1.bounds = me.clientrectangle

should and does work. What's confusing me now is that neither 'bounds'
nor 'clientrectangle' showed up in the Intellisense yet the code seems
to work. Why would that be?

JGD
 
G

Greg Burns

Take a look at the Anchor and Dock properties in the properites window for
the control. They may do want you want without needing to handcode
anything.

HTH,
Greg
 

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