This documentation is archived and is not being maintained.

ListViewItem.Position Property

Gets or sets the position of the upper-left corner of the ListViewItem.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

<BrowsableAttribute(False)> _
Public Property Position As Point
Dim instance As ListViewItem 
Dim value As Point 

value = instance.Position

instance.Position = value

Property Value

Type: System.Drawing.Point
The Point at the upper-left corner of the ListViewItem.


The Position is set when the containing ListView is in virtual mode.

The Position property should be set after the ListViewItem and containing ListView are constructed. Changing the Position property when the containing ListView is in Details or List view will have no effect on the position of the items. Also, the Position property will automatically change when the View property of the containing ListView is changed from SmallIcon, LargeIcon, or Tile view to List or Details. When the ListView is in SmallIcon, LargeIcon, or Tile view, setting the Position property for an item will cause the other items contained in the ListView to be rearranged.

The following code example demonstrates how to use the Position property of a ListViewItem. To run this example, paste the following code into a Windows Form and call the InitializePositionedListViewItems from the form's Load event-handling method. Click the button to see the items repositioned.

Private positionListView As ListView
Private moveItem As ListViewItem
Private WithEvents button1 As Button

Private Sub InitializePositionedListViewItems() 
    ' Set some basic properties on the ListView and button.
    positionListView = New ListView()
    positionListView.Height = 200
    button1 = New Button()
    button1.Location = New Point(160, 30)
    button1.AutoSize = True
    button1.Text = "Click to reposition" 

    ' View must be set to icon view to use the Position property.
    positionListView.View = View.LargeIcon

    ' Create the items and add them to the ListView. 
    Dim item1 As New ListViewItem("Click")
    Dim item2 As New ListViewItem("OK")
    moveItem = New ListViewItem("Move")
    positionListView.Items.AddRange(New ListViewItem() _
        {item1, item2, moveItem})

    ' Add the controls to the form. 

End Sub 

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    moveItem.Position = New Point(30, 30)
End Sub

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0