#DEFINE lvwColumnLeft 0 && Left #DEFINE lvwColumnRight 1 && Right #DEFINE lvwColumnCenter 2 && Center LOCAL llretVal llRetVal = DODEFAULT() IF llRetVal WITH Thisform.oListView *** Set up the icons to indicate Sort Order when you click on the column header .ColumnHeaderIcons = ThisForm.oHeaderIcons && this was set visually using the designer *** Must Add the Column Headers for all the fields we are going to display WITH .ColumnHeaders .Add( , , 'Code', 250, lvwColumnLeft ) .Add( , , 'Party', 250, lvwColumnLeft ) .Add( , , 'Quantity', 250, lvwColumnLeft ) ENDWITH WITH .ListItems *** Populate the sample listView with the records in the table SELECT Table1 SCAN *** Add the ListItem for this Record loItem = .Add( , ALLTRIM( TRANSFORM( Table1.Code ) ), TRANSFORM( Table1.Code) ) *** Use fields 2 - n to populate the list's SubItems *** If we are in report view IF Thisform.oListView.View = 3 && lvwReport WITH loItem .SubItems( 1 ) = ALLTRIM( Table1.Party ) .SubItems( 2 ) = TRANSFORM( Table1.Qty ) ENDWITH ENDIF ENDSCAN ENDWITH ENDWITH ENDIF RETURN llretVal