Exporting embedded resource files programmatically

f4vescent

New member
Joined
Jan 13, 2007
Messages
4
Programming Experience
1-3
I would like to create an MS Access database file that can be referenced by certain classes in a class library project. I want this Access database file to be an embedded resource that is exported to a user-selected directory during run time. Is it possible to export an embedded resource? Here is pseudocode to clarify my objective.

1. User inputs a directory to which the embedded Access database file (*.mdb) will be exported.
2. Program takes the embedded Access database file and exports it to the directory specified in step 1.
3. Program then writes data to the exported database.

'I am assuming I can get the embedded Access database file this way
'and then export it. I just have no idea how to export it.

Dim p_asm As System.Reflection.Assembly = Me.GetType.Assembly
Dim p_stream As System.IO.Stream
p_stream = p_asm.GetManifestResourceStream("Reports.Reports.mdb")
 
Read from the stream you've got and write to a FileStream. Create the FileStream by calling the OpenFile method of an SaveFileDialog, which will allow the user to select the path.
 
Back
Top