Click or drag to resize

ListView.AddItem Method (Typed)

X#
Add a new ListViewItem object as the last item in the list view.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VOGUIClasses (in XSharp.VOGUIClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD AddItem(
	oListViewItem AS ListViewItem
) AS USUAL
Request Example View Source

Parameters

oListViewItem
Type: ListViewItem
The ListViewItem object to add to the list view.

Return Value

Type: Usual
TRUE if the item was added successfully; otherwise, FALSE.
Examples
The example below shows how to populate a ListView control. Note that it is also storing the record number with each item also for later retrieval when any given item is selected:
X#
 1LOCAL cCoachName     AS string
 2LOCAL oItem         AS ListViewItem
 3DO WHILE !SELF:oCoachesServer:eof
 4cCoachName    :=     Trim( SELF:oCoachesServer:FIELDGET( #LastName ) ) ;
 5+ ", " + ;
 6Trim( SELF:oCoachesServer:FIELDGET( #FirstName ) ) + " " + ;
 7SELF:oCoachesServer:FIELDGET( #MiddleInit )
 8oItem:SetText( SELF:oCoachesServer:FIELDGET( #Season ), #cSeason )
 9oItem:SetValue( SELF:oCoachesServer:RecNo, #cCoachName )
10oItem:SetText( CoachName, #cCoachName )
11oItem:SetText( SELF:oCoachesServer:FIELDGET( #Gender ), #cGender )
12oItem:SetText( SELF:oCoachesServer:FIELDGET( #ClubCode ), #cClubCode )
13oItem:SetText( SELF:oCoachesServer:FIELDGET( #TeamNr ), #cTeamNr )
14oItem:SetText( SELF:oCoachesServer:FIELDGET( #HomePhone ),    #cHomePhone )
15oItem:SetText( SELF:oCoachesServer:FIELDGET( #WorkPhone ),    #cWorkPhone )
X#
1SELF:oDClvCoaches:AddItem( oItem )
2SELF:oCoachesServer:skip()
3ENDDO
See Also