<?xml version="1.0"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Select an Item in a Windows Forms ListBox Control</Title>
      <Author>Microsoft Corporation</Author>
      <Description>Selects an item in a ListBox control, programmatically.</Description>
      <Shortcut>lbSelect</Shortcut>
    </Header>
    <Snippet>
      <References>
        <Reference>
          <Assembly>System.Windows.Forms.dll</Assembly>
        </Reference>
      </References>
      <Imports>
        <Import>
          <Namespace>System</Namespace>
        </Import>
        <Import>
          <Namespace>Microsoft.VisualBasic</Namespace>
        </Import>
        <Import>
          <Namespace>System.Windows.Forms</Namespace>
        </Import>
      </Imports>
      <Declarations>
        <Object>
          <ID>listBoxName</ID>
          <Type>ListBox</Type>
          <ToolTip>Replace with a ListBox control on your form.</ToolTip>
          <Default>ListBox1</Default>
        </Object>
        <Object>
          <ID>index</ID>
          <Type>Integer</Type>
          <ToolTip>Replace with the index of the ListBox item to select.</ToolTip>
          <Default>1</Default>
        </Object>
      </Declarations>
      <Code Language="VB" Kind="method body"><![CDATA[$listBoxName$.SelectedIndex = $index$
]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>