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_RetrieveaTextFilefromanAssembly_sResour_142550_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  1KB  |  38 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>Retrieve a Text File from an Assembly's Resources</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Retrieves the text from a file that is an embedded resource of an assembly.</Description>
  8.       <Shortcut>appResText</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.       </References>
  13.       <Imports>
  14.         <Import>
  15.           <Namespace>System.IO</Namespace>
  16.         </Import>
  17.         <Import>
  18.           <Namespace>System.Reflection</Namespace>
  19.         </Import>
  20.         <Import>
  21.           <Namespace>Microsoft.VisualBasic</Namespace>
  22.         </Import>
  23.       </Imports>
  24.       <Declarations>
  25.         <Literal>
  26.           <ID>ResourceName</ID>
  27.           <Type>String</Type>
  28.           <ToolTip>The name of the resource.</ToolTip>
  29.           <Default>"AssemblyName.Filename.txt"</Default>
  30.         </Literal>
  31.       </Declarations>
  32.       <Code Language="VB" Kind="method body"><![CDATA[Dim executingAssembly As Assembly = Assembly.GetExecutingAssembly
  33.         Dim appStream As Stream = executingAssembly.GetManifestResourceStream($ResourceName$)
  34.         Dim textStream As New StreamReader(appStream)
  35.         Dim text As String = textStream.ReadToEnd]]></Code>
  36.     </Snippet>
  37.   </CodeSnippet>
  38. </CodeSnippets>