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_ReadfromanExistingTextFileinMyDocuments_142686_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  989b  |  26 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>Read a file in the My Documents folder</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Reads the contents of a text file in the My Documents folder into a single string.</Description>
  8.       <Shortcut>filReadMy</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <Declarations>
  12.         <Literal>
  13.           <ID>filename</ID>
  14.           <ToolTip>Replace with the file name.</ToolTip>
  15.           <Default>"test.txt"</Default>
  16.         </Literal>
  17.       </Declarations>
  18.       <Code Language="VB" Kind="method body"><![CDATA[Dim fullFilePath As String
  19. Dim fileContents As String
  20. With My.Computer.FileSystem
  21.     fullFilePath = .CombinePath(.SpecialDirectories.MyDocuments, $filename$)
  22.     fileContents = .ReadAllText(fullFilePath)
  23. End With]]></Code>
  24.     </Snippet>
  25.   </CodeSnippet>
  26. </CodeSnippets>