Display image from folder / file in vb.net

Dim ImagePath As String = "images/spaceship2.png" Dim img1 As Bitmap Dim newImage As Image = Image.FromFile("images/spaceship2.png") img1 = New Bitmap(ImagePath) pb2.ImageLocation = ImagePath pb1.Image = newImage 

I want to display an image from a folder, for example, a student with identification number 22137471, an image with the name 22137471 will be displayed on my picture box, between which I saw this code somewhere in google.

+6
source share
2 answers

I want to display an image from a folder, for example, a student with identifier number 22137471, an image named 22137471 will display in my image window

Try something like ...

  Dim id As String = "22137471" Dim folder As String = "c:\some path\folder" Dim filename As String = System.IO.Path.Combine(folder, id & ".png") PictureBox1.Image = Image.FromFile(filename) 
+7
source

You can try the following:

 PictureBox1.Image = Image.FromFile("c:\some path\folder\myImage.jpg") 
0
source

Source: https://habr.com/ru/post/957270/


All Articles