473,394 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to refresh an image control

Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.
Nov 12 '05 #1
6 8746
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file
path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.

Nov 12 '05 #2
Thanks Mike,

I was really wanting the image control to refresh immediately. For
instance, users will select thumbnails using the Windows API File
Browser. Once they do, I'd like for the image control to refresh
automatically, before users tab to another control or whatnot. Is
this doable?

Thanks,

Arnold

"Mike Storr" <st******@sympatico.ca> wrote in message news:<17*******************@news20.bellglobal.com> ...
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file
path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.

Nov 12 '05 #3
It does for me. The API call is returning a string containing the path to
the image. One of you events or functions are starting this process, that
same code can use the line I provided to reset the image before it ends. All
will appear to be done immediately. Or maybe I'm not quite understanding
you.
"Arnold" <ee*******@earthlink.net> wrote in message
news:18*************************@posting.google.co m...
Thanks Mike,

I was really wanting the image control to refresh immediately. For
instance, users will select thumbnails using the Windows API File
Browser. Once they do, I'd like for the image control to refresh
automatically, before users tab to another control or whatnot. Is
this doable?

Thanks,

Arnold

"Mike Storr" <st******@sympatico.ca> wrote in message

news:<17*******************@news20.bellglobal.com> ...
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.

Nov 12 '05 #4
NB
For some unknown reason, I face the same problem (Access XP on Win
2000 Pro)

After attching the image path, the image control does not display that
picture immediately. However it does when you go to another record
then go back.

Here is the code I use under the command button. Anyone has an idea
why does it not refresh the image?

On Error GoTo ErrHandler
Dim lngFlags As Long
Dim strFilter As String
Dim strPathAndFile As String
Me.AllowDeletions = False
strFilter = ahtAddFilterItem(strFilter, "Compressed Image Files
(*.jpg, *.jff, *.gif, *.tiff )", _
"*.JPG;*.JFF,*.GIF,*.TIF")
strFilter = ahtAddFilterItem(strFilter, "Uncompressed Image Files
(*.bmp, *.wmf)", "*.BMP, *.WMF")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strPathAndFile = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Choose an Image File")
If Len(strPathAndFile) > 0 Then
Me![imagePath] = strPathAndFile
Me![productImage].Picture = strPathAndFile
Me!imagePathLink = strPathAndFile & "#" & strPathAndFile &
"##" & "Link to image"
Me.Refresh
Else
Cancel = True
End If
Exit_Sub:
Exit Sub
ErrHandler:
MsgBox "Error " & Err.Number & " : " & Err.Description,
vbExclamation
Resume Exit_Sub

NB
Nov 12 '05 #5
Thanks again for responding Mike;

I'm new to coding with Modules and interfacing with API/ActiveX
controls, and can't really decipher the module code, which creates
various variables, like glpath, strPathAndFileName, etc. I found the
API Common Dialog Browser control code on one of the Access sites and
created a module with it. In the form's oncurrent event, I have the
following code:

On Error GoTo err_Form_Current

If Not Me!Thumbnail_Path = "" Or Not IsNull(Me!Thumbnail_Path)
Then
Me!ImageControl.Picture = GetPathPart & Me!Thumbnail_Path
Else
Me!ImageControl.Picture = ""
End If

I guess I don't know how to best modify the API code, and where best
to put the following code:

Me!ImageControl.Picture = Me!Thumbnail_Path

Thanks again,

Arnold

"Mike Storr" <no****@somewhere.con> wrote in message news:<E_********************@news20.bellglobal.com >...
It does for me. The API call is returning a string containing the path to
the image. One of you events or functions are starting this process, that
same code can use the line I provided to reset the image before it ends. All
will appear to be done immediately. Or maybe I'm not quite understanding
you.
"Arnold" <ee*******@earthlink.net> wrote in message
news:18*************************@posting.google.co m...
Thanks Mike,

I was really wanting the image control to refresh immediately. For
instance, users will select thumbnails using the Windows API File
Browser. Once they do, I'd like for the image control to refresh
automatically, before users tab to another control or whatnot. Is
this doable?

Thanks,

Arnold

"Mike Storr" <st******@sympatico.ca> wrote in message

news:<17*******************@news20.bellglobal.com> ...
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
> Hey there,
>
> I've browsed for some fixes to this but only found a couple of similar
> posts, which didn't solve my problem. I'm wondering how to refresh an
> image control in a form after a user clicks a cmd button to open the
> Windows API Common Dialog and selects a new file (jpeg). Images are
> initially loaded in the form's oncurrent event. I've tried using
> me.dirty = false to make the form current. Has anyone experienced
> this before?
>
> Thanks much.

Nov 12 '05 #6
On 27 Jan 2004 17:25:12 -0800, Arnold wrote:

Thanks again for responding Mike;

I'm new to coding with Modules and interfacing with API/ActiveX
controls, and can't really decipher the module code, which creates
various variables, like glpath, strPathAndFileName, etc. I found the
API Common Dialog Browser control code on one of the Access sites and
created a module with it. In the form's oncurrent event, I have the
following code:

On Error GoTo err_Form_Current

If Not Me!Thumbnail_Path = "" Or Not IsNull(Me!Thumbnail_Path)
Then
Me!ImageControl.Picture = GetPathPart & Me!Thumbnail_Path
Else
Me!ImageControl.Picture = ""
End If

I guess I don't know how to best modify the API code, and where best
to put the following code:

Me!ImageControl.Picture = Me!Thumbnail_Path

Thanks again,

Arnold


The message from NB seems to indicate this a problem in XP (2002 or 2003
I'm not sure). Is this your case as well? I haven't encountered this yet,
so I can't say why it does this. Wanted to make sure you understood that in
my example "Me!ImageControl.Picture", you are to replace the "ImageControl"
with the name of the image control you are using and Me!Thumbnail_Path with
the string being returned from the API you have used (I assumed there was a
textbox on the form displaying it).

If this still does not refresh to picture immediately, then try using
Me.Repaint to force access to redraw the form on screen.
--
Mike Storr
veraccess.com
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Greg Christie | last post by:
I think I have a somewhat unique situation here, so I thought I should post it for the few poor souls who run across it and try to google it like I did. First of all, I was getting the following...
6
by: Arnold | last post by:
Hi there, I've looked at numerous posts out there but have yet to find a solution to this. I have an image control on a main form that shows a linked jpeg thumbnail. Image controls are also on...
1
by: Sunit Joshi | last post by:
Hello All I have an image control in main.aspx in a method BuildImage() { //...code.. imgDisks.ImageUrl = "barChart.aspx"; }
6
by: Suraj Joneja | last post by:
Hi All, I've an image control on my ASP.net page. This displays an image named 'Logo.jpg' in the location '~\Images'. Another application can change this image. It can select any image and...
5
by: ramendra | last post by:
how to refresh a image control to pick up the latest image file on a asp.net page. i am generating a image based on the input from the user and displaying it on the page through image control. The...
1
by: Brian | last post by:
Using A2K I have an image control on a report and use code to set the image.picture to the required jpg. 3 of the jpgs resize properly but 2 do not - they display much smaller than the image...
0
by: PeterKellner | last post by:
I have an asp.net 2.0 Image control that I have surrounded with the appropriate atlas:UpdatePanel tags. The Image control referencs an aspx page whose only job is to output an Image. (it forms...
3
by: R.A.F. | last post by:
Hi, I have a custom control in which i have a property based on CollectionBase class. like the following one : //------- XGrid.cs file --------------// public ColumnsCollection Columns {
0
by: Erakis | last post by:
Hi, I need to put a very large image as background (1030px X 774px) on the main window of my application. Also, on this window I need to add transparent Usercontrol, Panel and Label. Every...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.