<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Pretty Form Caption using filename and version number.</Title>
      <Shortcut>PrettyFormCaptionusingfilenameandversionnumber.</Shortcut>
      <Description>Pretty Form Caption using filename and version number. [C#]</Description>
      <Author>David Gentils</Author>
      <HelpUrl>/PreviewSnippet.aspx?SnippetID=5cec6c6e-76b9-4eea-bea2-6a656745ea9e</HelpUrl>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="csharp"><![CDATA[///<summary>
///Sets a pretty form caption using a given filename with version info.
///</summary>
private void SetCaption(string filename)
{
	// Get assembly version info
	Version ver = new Version(Application.ProductVersion);
	// Format version major minor
	string captionString = string.Format("{0} v{1}.{2}",
		Application.ProductName, ver.Major, ver.Minor);
	
	// Check for empty filename and set caption accordingly
	if (filename != String.Empty)
		this.Text = captionString + " [" + System.IO.Path.GetFileName(filename) + "]";
	else
		this.Text = captionString;
}]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>