Code Snippet for ChooseContactDialog

Below is the source for the ChooseContactDialog that I mentioned during my webcast on SqlMobile development. To use this snippet save it to a text file called "ChooseContactDialog.snippet" and put it in your My Documents\Visual Studio 2005\VB\My Code Snippets folder.

<?xml version="1.0" encoding="UTF-8"?>
<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Choose Contact Dialog</Title>
<Shortcut>ChooseContactDialog</Shortcut>
<Description>Code snippet for the Windows Mobile ChooseContactDialog</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<References>
<Reference>
<Assembly>Microsoft.WindowsMobile.Forms.dll</Assembly>
</Reference>
<Reference>
<Assembly>Microsoft.WindowsMobile.PocketOutlook.dll</Assembly>
</Reference>
</References>
<Imports>
<Import>
<Namespace>Microsoft.WindowsMobile.Forms</Namespace>
</Import>
<Import>
<Namespace>Microsoft.WindowsMobile.PocketOutlook</Namespace>
</Import>
</Imports>
<Declarations>
<Literal>
<ID>title</ID>
<Default>"Select a Contact"</Default>
<ToolTip>The title for the dialog</ToolTip>
</Literal>
</Declarations>
<Code Language="VB" Kind="method body">
<![CDATA[ Dim contactPicker As New Microsoft.WindowsMobile.Forms.ChooseContactDialog
contactPicker.ChooseContactOnly = True ' Change this to false to display the property picker
contactPicker.Title = $title$

        If (contactPicker.ShowDialog() <> Windows.Forms.DialogResult.OK) Then
' Handle the cancel case here
End If

        ' Handle the ok case here.]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>