Problem with listbox

P

pist

Hello
I am using the following to calculate the number of visible lines in
a listbox. This works, but when I add a horizontal scroll bar it
does not work correctly. How can I subtract the size of the
horizontal bar to maintain correct value?

number_of_lines = listbox1.Height / listbox1.ItemHeight
 
K

Kerry Moorman

pist,

You might try:

number_of_lines = ListBox1.ClientSize.Height / ListBox1.ItemHeight

This will result in a value with a fractional part that you will need to
decide how to deal with.

Kerry Moorman
 

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

Top