Loading an array of images from an a file into a Picture Box in VB

  • Thread starter Thread starter MikeG0930
  • Start date Start date
M

MikeG0930

I want to be able to load images from a file located in a folder. I don't
want to use ImageList. These images will appear in a picture box one at a
time in succession. I am also using the BitBlt Function. The line of code I
am having trouble with is:

PicAnimDC = CreateDC(Application.StartupPath & picF(i), picH(i))

picAnimDC - Stores the device context
picF(i) - Stores filename constants
picH(i) - Stores handles of loaded pictures
 
MikeG0930 said:
I want to be able to load images from a file located in a folder. I don't
want to use ImageList. These images will appear in a picture box one at a
time in succession. I am also using the BitBlt Function. The line of code I
am having trouble with is:

PicAnimDC = CreateDC(Application.StartupPath & picF(i), picH(i))

picAnimDC - Stores the device context
picF(i) - Stores filename constants
picH(i) - Stores handles of loaded pictures

When you say you are having trouble on this line, what is the trouble?

As a guess, I would try the following to build the filename properly:

PicAnimDC = CreateDC(Path.Combine(Application.StartupPath, picF(i)), picH(i))

Mike
 
"Path" is showing up as not declared. The problem I am having is that the
images are not being located.
 
MikeG0930 said:
"Path" is showing up as not declared. The problem I am having is that the
images are not being located.

Try using System.IO.Path.Combine(...

Mike
 
Back
Top