extracting a embeded resource

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
this possible? if i use a resource in ym app to download it to a folder when running
 
Assuming that you added the resource to your project on the Resources page of the project properties, you access it via a property of My.Resources. What that property returns depends on the original type of the resource. If it was text then you'll get a String, if it was an image you'll get an Image and for most others you'll get a Byte array. You would then save that value to a file using the most appropriate method for the data type, e.g. File.WriteAllText, Image.Save, File.WriteAllBytes, etc.
 
Assuming that you added the resource to your project on the Resources page of the project properties, you access it via a property of My.Resources. What that property returns depends on the original type of the resource. If it was text then you'll get a String, if it was an image you'll get an Image and for most others you'll get a Byte array. You would then save that value to a file using the most appropriate method for the data type, e.g. File.WriteAllText, Image.Save, File.WriteAllBytes, etc.


Thanks

for any one else the code was

VB.NET:
        'Save new wallpaper image to c:\ drive
        My.Resources.Skull.Save("c:\Skull.jpg", _
                        System.Drawing.Imaging.ImageFormat.Jpeg)
 
Back
Top