Click to See Complete Forum and Search --> : How can I get the height of my text boxes and listboxes to match?


mazwinkel
June 15th, 2000, 06:33 AM
Hello -

Can anybody help me match the heights of my list boxes and text boxes?

I am a form which dynamically loads up a combination of 20 user controls at run time. Each user control is a strip with a label, a checkbox and either a list box or a text box (of varying lengths).

When the various user controls get loaded onto the form -the text boxes have more height than the list box in other user controls. The height of all text boxes is 285 and the height of the list box is 255 - however -I can't change the height property of the list box to 285.

Does anyone know of a way to do this or tell me why I can't- or can you suggest a strategy for making all text boxes and list boxes have an equal height.

Thanks very much.

Mairi

Lothar Haensler
June 15th, 2000, 06:37 AM
if I remember correctly you have to set the windows style of your listbox to LBS_NOINTEGRALHEIGHT.
From the docs:
"The size of the list box is exactly the size specified by the application when it created the list box. Usually, Windows sizes a list box so that the list box does not display partial items."

use the SetwindowLong API to set the window style.

Chris Eastwood
June 15th, 2000, 06:45 AM
... Or you can just set the 'IntegralHeight' property to false :)


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Lothar Haensler
June 15th, 2000, 06:47 AM
...just found it.
still mentally stuck in VB 3 world... :-)

mazwinkel
June 16th, 2000, 02:12 AM
Thank you very much for taking the time to respond - this was just what I was after!

Regards,
Mairi