Problem with listbox

  • Thread starter Thread starter pist
  • Start date Start date
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
 
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
 
Back
Top