Expand|Select|Wrap|Line Numbers
- Public Sub CreateFileFromResourceFile(ByVal pIn As String, ByVal pOut As String)
- Dim currAssembly As Reflection.Assembly
- Dim input As Stream
- Dim output As Stream
- Dim Buffer(20000) As Byte
- Dim read As Integer
- currAssembly = System.Reflection.Assembly.GetEntryAssembly()
- input = currAssembly.GetManifestResourceStream(pIn)
- output = New FileStream(pOut, FileMode.Create, FileAccess.Write, FileShare.Write)
- input.Seek(0, SeekOrigin.Begin)
- read = input.Read(Buffer, 0, 20000)
- While read > 0
- output.Write(Buffer, 0, read)
- read = input.Read(Buffer, 0, 20000)
- End While
- input.Close()
- output.Close()
- End Sub
pIn : String that represents the embedded resource
pOut : Where you want the file written
If you need to find the names of your embedded resources, in the immediate window type in:
Expand|Select|Wrap|Line Numbers
- ?System.Reflection.Assembly.GetEntryAssembly.GetManifestResourceNames