ExtremeFitness
asked on
VB.Net How do i get an image out of my Resource file ??
VB.Net How do i get an image out of my Resource file at runtime??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry hit submit to quickly...
ImageFileName = the name of the embedded file.
Also this works best if there are no spaces in your solution and project names.
ImageFileName = the name of the embedded file.
Also this works best if there are no spaces in your solution and project names.
For embedded resources you can use this instead:
private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Image = new Bitmap(this.GetType(), "myImage.jpg");
}
private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Image = new Bitmap(this.GetType(), "myImage.jpg");
}
VB.Net would be:
PictureBox1.Image = New Bitmap(Me.GetType(), "myImage.jpg")
PictureBox1.Image = New Bitmap(Me.GetType(), "myImage.jpg")
Public Function RetrieveEmbeddedImage(ByVa
ImageName = System.Reflection.Assembly
Dim img As Image
Dim strm As Stream = _
System.Reflection.Assembly
If Not strm Is Nothing Then
img = Image.FromStream(strm)
End If
strm.Close()
Return img
End Function