Can you load image on form from a variable?

D

Dennis

Hi,

I’m on Windows XP running Office 2003 Access and my application runs on
small network.

I am displaying two different jpg images (logos) in the top left corner of a
form’s windows. The customer table is shared by two sister companies (for a
whole bunch of reasons we want to keep the data together). When a customer
is displayed on the screen, I display the appropriate logo in the top left
corner. I have no problem doing this.

The logos are small images, 3 or 4k. Is there a way I can load the two jpgs
into two different variables during the form’s Load event and then set the
image equal to one of the two variables when the customer changes? This
would prevent me having to read the image from disk over the network each
time.


Here is my current code:

Select Case strCoNo
Case cstrPcDoc
ImgLogo.Picture = cstrLogoPath & cstrPcDocLogo
Case cstrITGrp
ImgLogo.Picture = cstrLogoPath & cstrITGrpLogo
Case Else
ImgLogo.Picture = cstrLogoPath & cstrPcDocLogo
End Select

The variables cstrLogoPath, cstrPcDocLogo are constants set at the top of
the VB code.

Once I get this working, I’ll put in some logic to remember that last logo
so if it does not change, then I will not change the image.
 
D

Douglas J. Steele

As far as I know, there's no easy way to do what you're trying to do. Could
you possibly have three different picture controls, load all three of them
once, and just control which one's visible?
 
D

Dennis

Doug,

Could you possibly have three different picture controls, load all three of
them
once, and just control which one's visible?

Actually, I just new two. The third condition displayed the first logo.
How would I load the two? Do I just place two different images controls on
my form design and control which one displays by using:

If strCoNo = cstrITGrp then
me.ImgPcDocLogo.Visible = False
me.ImgITGrpLogo.Visible = True
else
me.ImgITGrpLogo.Visible = False
me.ImgPcDocLogo.Visible = Truen
End

or is there a better way.

Also, the logos are of different widths, but I have that part of the code
working just fine so I did not include it in my original code. I change
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top