This documentation is archived and is not being maintained.

ListBox.GetItemHeight Method

Returns the height of an item in the ListBox.

[Visual Basic]
Public Function GetItemHeight( _
   ByVal index As Integer _
) As Integer
public int GetItemHeight(
 int index
public: int GetItemHeight(
 int index
public function GetItemHeight(
   index : int
) : int;


The zero-based index of the item to return the height for.

Return Value

The height, in pixels, of the specified item.


Exception Type Condition
ArgumentOutOfRangeException The specified index was outside the range valid values.


If the DrawMode property is not set to DrawMode.OwnerDrawVariable, the value of the index parameter is ignored because all items in a standard ListBox are the same size. You can use this property when you are using an owner-drawn ListBox to determine the size of any item within the ListBox.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ListBox Class | ListBox Members | System.Windows.Forms Namespace