showing images in form

bigmac

Registered User.
Local time
Yesterday, 16:00
Joined
Oct 5, 2008
Messages
302
hi all, i want to show an image on a form (2003), this image will change depending on which control button is clicked, how do i do this? i have searched but did not find a solution to suit any ideas please or point me to a post that hase a sample please.
 
Put each of the images you want to display in controls that are exactly the same size and in the same position on the form with each control's visible property set to No. In the OnClick event of your command buttons enter code to change the visible property of the desired control to Yes.
 
how do i put the images in controls please?
 
Open your form in design view. Access has an image control on the toolbar. Click it, and then click anywhere on your form. Acces will prompt you for the location of the image. Select your image and click the open button. The image should now appear in the image control on your form. Give the control a descriptive name, and then repeat the process for each image you need. Remember to set the visible property to No on each of your image controls. Then in the OnClick event of each command button you can enter code to change the visible property of the associated image to visible with (Me.image1.Visible = True).
 
If the images are all the same size and aspect ratio then use one control and on the Onclick of the desired button get it to change the image based on what you have clicked.

So if you have a folder called images and in there you have ten images you can say


Sub Cmd1.Click()
Me.ImageControl.Picture = "C:\....\Image1.bmp"
End Sub

Sub Cmd2.Click()
Me.ImageControl.Picture = "C:\....\Image2.bmp"
End Sub


etc

This way you only need one image control
 
i think you got me wrong about what i am trying to achieve, first off i have several command buttons on my form, i want to be able to press a particular button (9) and a particular image say( image 134 ) appears on my form in a frame ( call the frame x) then if i press another button (10) the same thing happens only this time (image 123)appears in frame X , and after a delay or about ten secs then all pictures will disapear and leave frame x empty. hope this explains it a bit better to you.
ps not good at vba so please explain code. regards mac:confused:
 
What is the object of the exercise? A clearer understanding of the issue may lead to a quicker resolution. From the end users point of view what will the images tell me? why do I have to click a button to see them? is this some sort of wizard you are building?
 
if you look at the attached file this might make things clearer. on the frmform1 ,open tab codings, there you will see a frame on the right of the form, on the left you will see a list called "POS" i want to change this list of labels to buttons(this i can do) then on pressing a button an image will appear in the frame, the reason for this is so the user can see what weld position is ment by name of the button, for example button F2 if pressed will show a image of the weld position for welding fillet welds in the F2 position. the user might not know all the positions by heart so they can refresh ther memory by looking at an image. also after the image is shown i would like the image to disapear after obout 10 secs .
does this help you to understand what i am after? i have other problems to ask but that will be another post in the future. regards mac
 

Attachments

Right, I have had a look at your mdb and as per my earlier post #6 my assumptions were correct. Once you have changed your lables to buttons (allthough you don't need to as a label has an OnClick event) simply update the image control to the path of the relevant image and image name.

Solution:
Create a new folder that will be used to store the relevant images
Copy all your image files into this folder.
Add an image control to your frmForm1 form called imgPicture

Set the timer interval on your form to 10000

Type in the following on your forms Timer event

Code:
Private Sub Form_Timer()
   Me.imgPicture.Visible = False
End Sub

On the OnClick event of your label/button place the following lines of code

Code:
Sub CmdF1_OnClick()
   Me.imgPicture.Visible = True
   Me.TimerInterval = 10000 '10 seconds
   Me.imgPicture.Picture = "C:\Weld\Images\F1.bmp"
   DoEvents
End Sub



Where C:\Weld\Images\ is the path to your images - this can be either locally or on a server. And F1.bmp is the name of the image to display once the button is clicked.

David
 
how do i set the form timer interval please? and still could not get it to show me a picture, could you show me how in a form please so i can see it and learn how you do it? regards mac
 
Me.TimerInterval = 10000 '10 seconds


???
 
Here is a very simple demo I have knocked together to show you the basic principle of what you are attempting to acheive.

Let me know if it works for you. You may need to change the path to the images as well as the image names. I used the sample pictures form the all users folder.

David
 

Attachments

Mac,

Take a look at the attached database. I've added five images that display when the labels F1 through F5 are clicked. Is this what you were looking to do?

Ken
 

Users who are viewing this thread

Back
Top Bottom