Microsoft KB Archive/242397

= How To Add Subitems to a ListView Result View in Report Mode =

Article ID: 242397

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Management Console 1.1
 * Microsoft Management Console 1.2
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q242397



SUMMARY
This article demonstrates how to add subitems to a ListView Result View when a ScopePane item is viewed in Detail mode.



Steps to Add Subitems to a ListView Result View in Report Mode
 Launch Visual Basic and select a new SnapIn project from the New Project dialog box. Open the SnapIn1 Designer through the Project Explorer window and insert a new ListView Result View under the Static Node. By default, the ListView will be named ListView1. View the properties of the new ListView Result View and insert two columns using the Columns Headers tab. The Text and Key must have the same value. Also, select Auto-Width.  Open the SnapIn1 Designer code window and paste the following code: Private Sub ResultViews_Initialize(ByVal ResultView As SnapInLib.ResultView)

With ResultView.ListView .ListItems.Add 1,, "Column 1" ' same as Key field in ColumnHeader .ListItems.Add 2,, "Column 2" ' same as Key field in ColumnHeader ' add our subitems to the listview .ListItems(1).ListSubItems.Add 1,, "Data 1" ' add data to the first row, column one .ListItems(1).ListSubItems.Add 2,, "Data 2" ' add data to the first tow, column two .ListItems(2).ListSubItems.Add 1,, "Data 3" ' add data to the second row, column one .ListItems(2).ListSubItems.Add 2,, "Data 4" ' add data to the second tow, column two End With End Sub

 View the properties of the SnapIn (SnapIn1) and set the Default Result View field to ListView1. Compile the project and start the Microsoft Management Console (MMC). Load the SnapIn in MMC and click the SnapIn1 Scope Item. The two columns defined in the ListView Result View should be rendered in the Result View window.</li> Change the View Mode to Detail. The Result View will change into a Report View. There will be two rows of data, each row containing two columns of data.</li></ol>

Additional query words: snapin designer mmc

Keywords: kbhowto kbsnapin kbdswmanage2003swept KB242397

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.