This documentation is archived and is not being maintained.

DocumentList Class

Represents a Pocket PC control for displaying and managing documents in a consistent way.

Namespace:  Microsoft.WindowsCE.Forms
Assembly:  Microsoft.WindowsCE.Forms (in Microsoft.WindowsCE.Forms.dll)

'Declaration
Public Class DocumentList _
	Inherits Control
'Usage
Dim instance As DocumentList

A DocumentList control provides a managed implementation of the native Windows CE DocList control, the control that is visible, for example, when you start Microsoft® Pocket Word and Microsoft® Pocket Excel. This control provides the following functionality:

  • Select, delete, copy, move, and rename files and folders.

  • Sort by a file name, date, or size.

  • E-mail files.

  • Send files by infrared to another device.

A DocumentList is a control rather then an entire dialog like such as FileDialog. Using a DocumentList control allows you include custom menus or other controls in your files selection UI.

A DocumentList should have the same width as the form on which it is placed. The length can be as long as needed.

A DocumentList only displays the files of a selected folder in the My Documents hierarchy.

TopicLocation
How to: Use a DocumentList Control.NET Compact Framework
How to: Use a DocumentList Control.NET Compact Framework
How to: Use a DocumentList Control.NET Compact Framework

The following code example creates a DocumentList control contained in a Panel.

Imports System
Imports System.Drawing
Imports System.Collections
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports Microsoft.WindowsCE.Forms


Public Class Form1
   Inherits System.Windows.Forms.Form
    Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
    Friend WithEvents DocumentList1 As Microsoft.WindowsCE.Forms.DocumentList

  Public Shared Sub Main()
    Application.Run(New Form1)
 End Sub 

   Public Sub New()

      InitializeComponent()
      Me.MinimizeBox = false
      Me.DocumentList1 = New DocumentList

   'Set up file extension filters for a 
   'DocumentList and set the initial folder 
   'to the Busines folder under My Documents. 
    With DocumentList1
      .Parent = Me
      .Filter = " |*.*| |*.txt;*.xml| |*.pwi;*.pdt| |*.pxl;*.psw| |*.jpg;*.gif;*.bmp| |*.wav;*.wmv;*.mpg;"
      .FilterIndex = 0
      .SelectedDirectory = "Business" 
    End With 


   End Sub  


   Protected Overrides Sub Dispose(disposing As Boolean)
      MyBase.Dispose(disposing)
   End Sub  

   Private Sub InitializeComponent()
      Me.SuspendLayout()
        Me.StatusBar1 = New System.Windows.Forms.StatusBar
        
        'StatusBar1 
        
        Me.StatusBar1.Location = New System.Drawing.Point(0,248)
        Me.StatusBar1.Size = New System.Drawing.Size(240,22)
        
       
      Me.Controls.Add(Me.StatusBar1)
      Me.Text = "DocList Demo" 
      Me.ResumeLayout(False)
   End Sub  

  ' Handle the DeletingDocument  
  ' event with code to close the file. 
   Private Sub DocList_DeletingDocument(ByVal sender As Object, _
   ByVal docevent As Microsoft.WindowsCE.Forms.DocumentListEventArgs) _
   Handles DocumentList1.DeletingDocument

       StatusBar1.Text = "Deleted: " & docevent.Path
       ' Add code to close any instances of the file. 
   End Sub 

   ' Handle the DocumentedActivated    
   ' event with code to open the file. 
    Private Sub DocList_DocumentActivated(ByVal sender As Object, _
    ByVal docevent As Microsoft.WindowsCE.Forms.DocumentListEventArgs) Handles DocumentList1.DocumentActivated

        StatusBar1.Text = "Activated: " & docevent.Path
     ' Add code to open the selected file. 

    End Sub 

    ' Handle the SelectedDirectoryChanged 
    ' event with code that sets the correct   
    ' path for opening and closing files. 
    Private Sub DocList_SelectedDirectoryChanged(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles DocumentList1.SelectedDirectoryChanged

        StatusBar1.Text = "Folder: " & DocumentList1.SelectedDirectory
        ' Add code to access the selected folder to open and close files.     

    End Sub 
End Class

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Mobile for Pocket PC

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 Compact Framework

Supported in: 3.5, 2.0
Show: