© 2004 Microsoft Corporation. All rights reserved.

Figure 2 ListLists Method
  <WebMethod()> Public Function ListLists() As DataSet
' Returns a list of available lists as a dataset.
  Dim dsList As DataSet
  Dim recItem As DataRow
  Dim strDirectory As String
  Dim strPath As String
' Define the default structure for the dataset that will be returned.
  dsList = New DataSet()
  dsList.ReadXml(Server.MapPath("empty list.xml"))
  dsList.Clear()
' Build the path for the directory where the lists are stored.
  strPath = Server.MapPath("empty list.xml")
  strPath = Left(strPath, Len(strPath) - 14)
  strPath += "*.xml"
' Retrieve the directory.
  strDirectory = Microsoft.VisualBasic.Dir(strPath)
  Do While strDirectory <> ""
    If (strDirectory <> "empty list.xml") Then
      recItem = dsList.Tables(0).NewRow
      dsList.Tables(0).Rows.Add(recItem)
      recItem("Item") = strDirectory
      dsList.AcceptChanges()
    End If
    strDirectory = Microsoft.VisualBasic.Dir()
  Loop
' Return the directory listing.
  ListLists = dsList
End Function

Figure 8 Controls in the .NET Compact Framework

Button
CheckBox
ColorDialog
ComboBox
ContextMenu
DateTimePicker
DomainUpDown
ErrorProvider
GroupBox
HScrollBar
ImageList
Label
LinkLabel
ListBox
ListView
MainMenu
MonthCalendar
NumericUpDown
OpenFileDialog
PanelPictureBox
ProgressBar
RadioButton
SaveFileDialog
StatusBar
TabControl
TextBox
Timer
ToolBar
ToolTip
TrackBar
TreeView
VScrollBar

Figure 9 Supported File Types

Project Item
File Extension
Description
Assembly Info File
.vb
A file used to store assembly information such as versioning and assembly name.
Assembly Resource File
.resx
A file containing localization information for a project when the Localized property is set to true.
Bitmap
.bmp
A blank bitmap image file that can be used for creating simple images.
Class
.vb
A code file that initially contains a single empty class declaration.
Code File
.vb
An empty Visual Basic or Visual C# code file; it contains no code.
Component Class
.vb
A class (a business object) for which a visual designer exists.
Cursor File
.vb
An image file for creating custom cursors.
Custom Control
.vb
A Windows control that is not visually designed, which means it does not have a graphical design surface. You must create the control by writing code.
Data Form
.vb
A data form which assists in creating data connections.
Data Set
.xsd
An XSD schema that generates classes for the dataset that you can use to access the data programmatically.
Dynamic Discovery
.vsdisco
Sometimes called a disco file, this file provides a means to enumerate all Web Document Services and all schemas in a Web project.
Icon File
.vb
An image file for creating a custom icon.
Inherited Form
.vb
A Windows form that you derive from another form by using visual inheritance. When you inherit from another form, you receive this form as your initial form. You can then visually add to it or change its contents.
Inherited User Control
.vb
Similar to a User Control except that it is derived from another existing User Control.
Module (Visual Basic only)
.vb
A code file that initially contains a single file for storing functions.
Static Discovery File
.disco
A file used to publish information about a Web Service.
Text File
.txt
An empty text file.
User Control
.vb
A control (a visual element) that you can place on a Windows form. It has a visual designer.
Windows Form
.vb
A basic Windows form that you use for local applications. It has a graphical design surface.
XML File
.xml
An XML document file.
XML Schema
.xsd
An XSD schema file without the generated classes.

Figure 10 The ListListsMethod

  Private Sub ListLists(ByVal NewSource As loadModes)
' Generates and loads a list of the available lists, 
' whether those lists are
' stored locally or remotely.
  Dim dsReturned As DataSet
  Dim intCounter As Int16
  Dim strDirectory As String
  Dim wsXMLList As New localhost.XMLList()

' Clear out the existing items.
  lstLists.Items.Clear()

' Load the requested list.
  Select Case NewSource

' The list is stored locally.
    Case loadModes.Local
      strDirectory = Microsoft.VisualBasic.Dir(Application.StartupPath _
      & "\*.xml")
      Do While strDirectory <> ""
        If (strDirectory <> "empty list.xml") Then
          lstLists.Items.Add(strDirectory)
        End If
        strDirectory = Microsoft.VisualBasic.Dir()
      Loop

' The list is stored remotely.
    Case loadModes.Remote
      dsReturned = wsXMLList.ListLists()
      For intCounter = 0 To (dsReturned.Tables(0).Rows.Count) - 1
        lstLists.Items.Add(dsReturned.Tables(0).Rows(intCounter)("Item"). 
        ToString())
      Next
  End Select

End Sub

Figure 11 The LoadList Method

  Private Sub LoadList(ByVal strListName As String)
' Loads the specified list into the interface.
  Dim wsXMLList As New localhost.XMLList()

' Make sure there is a dataset to work with.
  If (Me.dsList Is Nothing) Then
    dsList = New DataSet()
  Else
    dsList.Clear()
  End If

' Retrieve the list either from a local or remote source.
  If (cmdLocation.Text = "Local") Then
    dsList.ReadXml(Application.StartupPath & "\" & strListName)
  Else
    dsList = wsXMLList.LoadList(strListName)
  End If

' Clear the list of any existing items.
  lstItems.Items.Clear()

' Load the list.
  lstItems.Items.Add(dsList.Tables(0).Rows(intCounter)("Item")

' Reset the flag used to track changes to the active list.
  bolIsDirty = False

End Sub

Figure 12 The SaveList Method

  Private Sub SaveList(ByVal strListName As String)
' Save the selected list.
  Dim bolResult As Boolean
  Dim intCounter As Int16
  Dim recItem As DataRow
  Dim wsXMLList As New localhost.XMLList()

' Start with an empty dataset.
  If (Me.dsList Is Nothing) Then
    dsList = New DataSet()
  Else
    dsList.Clear()
  End If

' Load the contents of the list box into the dataset.
  For intCounter = 0 To lstItems.Items.Count - 1
    recItem = dsList.Tables(0).NewRow
    dsList.Tables(0).Rows.Add(recItem)
    recItem("Item") = lstItems.Items(intCounter).ToString
    dsList.AcceptChanges()
  Next

' Persist the contents of the dataset to a file as XML.
  If (cmdLocation.Text = "Local") Then
    dsList.WriteXml(Application.StartupPath & "\" & strListName)
  Else
    bolResult = wsXMLList.SaveList(strListName, dsList)
  End If

' Switch to using a list mode.
  SwitchModes(listModes.Use)

End Sub