I've been having some difficulties with setting the height of a listbox.
Code like this...
listbox1.Height = some_number;
... works only for some numbers. It seems that height of listbox may be only multiplication of height of its element. Is there a way how to "override" this behaviour?
Step 2: Drag the ListBox control from the ToolBox and drop it on the windows form. You are allowed to place a ListBox control anywhere on the windows form according to your need. Step 3: After drag and drop you will go to the properties of the ListBox control to set the size of the ListBox.
The integral height is based on the height of the ListBox, rather than the client area height. As a result, when the IntegralHeight property is set true , items can still be partially shown if scroll bars are displayed.
To insert an item into the list box at a specific position, use the Insert method. To add a set of items to the list box in a single operation, use the AddRange method.
Try,
listbox1.IntegralHeight=false;
listbox1.Height=some_int_number;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With