ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refresh image on userform (https://www.excelbanter.com/excel-programming/356723-refresh-image-userform.html)

Graham S

Refresh image on userform
 
I have created a userform to manage a simple database. On the userform is an
image control which shows a (small) picture from the current record. As I
scroll through the database, the image changes happily. So far so good.
I have now added a click event to the image which loads the current record
picture into a second image control which is contained on a large, but
currently invisible, frame. I then make the frame visible, which gives the
illusion of showing a larger version of the original picture. This larger
image has a click event which simply sets the frame's visible property to
false, hiding the image and returning the user to the original form. Again,
all works well.
Now for the problem... the first image control with the small picture (on
line 2 above!) no longer updates as I continue to scroll through the data.
If I click the image again, the correct 'blow-up' appears, but the small
image does not refresh.
I tried an alternative approach using a second user form to show the
enlarged pcture but still the same problem.
Can anyone suggest a remedy (aside from using Access!!)?
Thanks
--
Graham

Harald Staff

Refresh image on userform
 
Hi Graham

Without the possibility to test your setup, this is the general cure for
things like that:

DoEvents
Me.Repaint
DoEvents

HTH. Best wishes Harald

"Graham S" skrev i melding
...
I have created a userform to manage a simple database. On the userform is

an
image control which shows a (small) picture from the current record. As I
scroll through the database, the image changes happily. So far so good.
I have now added a click event to the image which loads the current record
picture into a second image control which is contained on a large, but
currently invisible, frame. I then make the frame visible, which gives

the
illusion of showing a larger version of the original picture. This larger
image has a click event which simply sets the frame's visible property to
false, hiding the image and returning the user to the original form.

Again,
all works well.
Now for the problem... the first image control with the small picture (on
line 2 above!) no longer updates as I continue to scroll through the data.
If I click the image again, the correct 'blow-up' appears, but the small
image does not refresh.
I tried an alternative approach using a second user form to show the
enlarged pcture but still the same problem.
Can anyone suggest a remedy (aside from using Access!!)?
Thanks
--
Graham




Graham S

Refresh image on userform
 
Your suggestion worked. I'd tried the DoEvents but on its own that wasn't
enough. The Repaint was not obvious but did the trick. Many thanks.
--
Graham


"Harald Staff" wrote:

Hi Graham

Without the possibility to test your setup, this is the general cure for
things like that:

DoEvents
Me.Repaint
DoEvents

HTH. Best wishes Harald

"Graham S" skrev i melding
...
I have created a userform to manage a simple database. On the userform is

an
image control which shows a (small) picture from the current record. As I
scroll through the database, the image changes happily. So far so good.
I have now added a click event to the image which loads the current record
picture into a second image control which is contained on a large, but
currently invisible, frame. I then make the frame visible, which gives

the
illusion of showing a larger version of the original picture. This larger
image has a click event which simply sets the frame's visible property to
false, hiding the image and returning the user to the original form.

Again,
all works well.
Now for the problem... the first image control with the small picture (on
line 2 above!) no longer updates as I continue to scroll through the data.
If I click the image again, the correct 'blow-up' appears, but the small
image does not refresh.
I tried an alternative approach using a second user form to show the
enlarged pcture but still the same problem.
Can anyone suggest a remedy (aside from using Access!!)?
Thanks
--
Graham






All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com