home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_LocateAnItemInAListBoxControl_snippet_142606_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  50 lines

  1. <?xml version="1.0"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Locate an Item in a Windows Forms ListBox Control</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Locates the first incidence of a string in a ListBox control.</Description>
  8.       <Shortcut>lbLocate</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.         <Reference>
  13.           <Assembly>System.Windows.Forms.dll</Assembly>
  14.         </Reference>
  15.       </References>
  16.       <Imports>
  17.         <Import>
  18.           <Namespace>System</Namespace>
  19.         </Import>
  20.         <Import>
  21.           <Namespace>Microsoft.VisualBasic</Namespace>
  22.         </Import>
  23.         <Import>
  24.           <Namespace>System.Windows.Forms</Namespace>
  25.         </Import>
  26.       </Imports>
  27.       <Declarations>
  28.         <Object>
  29.           <ID>listBoxName</ID>
  30.           <Type>ListBox</Type>
  31.           <ToolTip>Replace with a ListBox control on your form.</ToolTip>
  32.           <Default>ListBox1</Default>
  33.         </Object>
  34.         <Literal>
  35.           <ID>searchString</ID>
  36.           <Type>String</Type>
  37.           <ToolTip>Replace with the String whose location you are trying to find.</ToolTip>
  38.           <Default>"Maria"</Default>
  39.         </Literal>
  40.       </Declarations>
  41.       <Code Language="VB" Kind="method body"><![CDATA[Dim index As Integer
  42. index = $listBoxName$.FindString($searchString$)
  43. If index <> ListBox.NoMatches Then
  44.     ' Item found.
  45. Else
  46.     ' Item not found.
  47. End If]]></Code>
  48.     </Snippet>
  49.   </CodeSnippet>
  50. </CodeSnippets>