Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep the listbox remained at constant.size

Status
Not open for further replies.

cogivina

Programmer
Jun 3, 2003
36
US
Hi,
I have set the height of the listbox (my_table) at 190. but its size always changed everytime the form is openned. How do I keep the table appeared at a constant size? Thanks.

With frm_Test
.Year.Caption = UCase(Range("Year"))
.My_Table.Top = 20
.My_Table.Height = 190
.Show
End With
 
I have run into this.

I think the list box adjusts its height dependant on the font size and font style so that it can hold full lines of data (no partially shown lines). You have to experiment to get the right height. If 190 adjusts, then try 189, 188 etc. You may be forced to go to 188.5 or something. Eventually you will come across the correct height. If you adjust the font size/style on the fly in your code, the list box will adjust again.

There is probably a formula for determining the number of pixels that a row of text takes up. You could then calculate the correct height for any font size or style. You probably have better things to do with your time.

Greg
 
Ty setting the Listbox's IntegralHeight property to false
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top