VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

You are here: Visual Basic > Advanced VB6 tutorial > Chapter 4

Arrange, Sorted, SortKey, and SortOrder Properties of ListView Control in Visual Basic 6

Arrange Property

The Arrange property of the ListView determines how items are arranged within a list. Arrange can have one of the following three values:

  • lvwNone (0) Items are not arranged within the ListView.

  • lvwAutoLeft (1) Items are arranged along the left side of the ListView.

  • lvwAutoTop (2) Items are arranged along the top border of the ListView.

The ListItem's appearance in a ListView is also determined by the sorting properties.

Sorted, SortKey, and SortOrder Properties

Three properties—Sorted, SortKey, and SortOrder—determine the order of ListItems in a ListView control.

The Sorted property can have one of two values, True or False. If Sorted is False, the items in the ListView are not sorted. If the Sorted property is set to True, the ListItems will be sorted with an order that depends on the other two properties: SortKey and SortOrder. The values of SortOrder and SortKey are ignored unless the Sorted property is set to True.

SortOrder specifies whether the ListItems appear in ascending (lvwAscending) or descending (lvwDescending) order. Ascending order is the default for SortOrder. SortKey identifies on what the items in the list will be sorted. By default the items in the list will be sorted by the Text property of the ListItems.

If your ListView is in a report format with multiple columns, you can sort by using the text value of any of the columns by setting the SortKey property to the desired column. If SortKey is 0, the list will be sorted by the ListItems().Text property. If SortKey is greater than 0, the sort will take place using one of the additional report columns in the control (described in the following page).

ListView Control topics


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved