Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB7
Expertise: Intermediate
Jul 14, 2003



Application Security Testing: An Integral Part of DevOps

GetResourceContent - Retrieving the content of an embedded text file

' Retrieve the content of an embedded text file
' Note: the file must be included in the project as an embedded resource.
'  - after adding the file to the project set its Build Action property to 
' Embedded Resource
' Example: txtScript.Text = GetResourceContent("script.sql")

Function GetResourceContent(ByVal filename As String) As String
    ' get the current assembly
    Dim asm As System.Reflection.[Assembly] = _
    ' resources are named using a fully qualified name
    Dim strm As System.IO.Stream = asm.GetManifestResourceStream(asm.GetName() _
        .Name + "." + filename)
    ' read the contents of the embedded file
    Dim reader As New System.IO.StreamReader(strm)
    GetResourceContent = reader.ReadToEnd()
End Function
Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date