Share via


Code Snippet for CameraCaptureDialog

Here's a code snippet for using the camera capture dialog. To use this snippet save it to a text file called "CameraCaptureDialog.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>Camera Capture Dialog</Title>
<Shortcut>CameraCaptureDialog</Shortcut>
<Description>Code snippet for the Windows Mobile CameraCaptureDialog</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<References>
<Reference>
<Assembly>Microsoft.WindowsMobile.Forms.dll</Assembly>
</Reference>
</References>
<Imports>
<Import>
<Namespace>Microsoft.WindowsMobile.Forms</Namespace>
</Import>
</Imports>
<Declarations>
<Literal>
<ID>title</ID>
<Default>"Take a Picture"</Default>
<ToolTip>The title for the dialog</ToolTip>
</Literal>
</Declarations>
<Code Language="VB" Kind="method body">
<![CDATA[
Dim cameraDialog As New CameraCaptureDialog()

        cameraDialog.Owner = Me
cameraDialog.Title = "Take a Picture"

        If ((cameraDialog.ShowDialog() <> DialogResult.OK) _
Or (cameraDialog.FileName = "")) Then
' Handle the cancel case here.
End If
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

[Author: Neil Enns]