473,769 Members | 6,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8824
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*******@eart hlink.net> wrote in message
news:18******** *************** ***@posting.goo gle.com...
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******@sympa tico.ca> wrote in message news:<17******* ************@ne ws20.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*******@eart hlink.net> wrote in message
news:18******** *************** ***@posting.goo gle.com...
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*******@eart hlink.net> wrote in message
news:18******** *************** **@posting.goog le.com...
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******@sympa tico.ca> wrote in message

news:<17******* ************@ne ws20.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*******@eart hlink.net> wrote in message
news:18******** *************** ***@posting.goo gle.com...
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.AllowDeletio ns = False
strFilter = ahtAddFilterIte m(strFilter, "Compressed Image Files
(*.jpg, *.jff, *.gif, *.tiff )", _
"*.JPG;*.JFF,*. GIF,*.TIF")
strFilter = ahtAddFilterIte m(strFilter, "Uncompress ed Image Files
(*.bmp, *.wmf)", "*.BMP, *.WMF")
strFilter = ahtAddFilterIte m(strFilter, "All Files (*.*)", "*.*")
strPathAndFile = ahtCommonFileOp enSave(InitialD ir:="C:\", _
Filter:=strFilt er, FilterIndex:=3, Flags:=lngFlags , _
DialogTitle:="C hoose an Image File")
If Len(strPathAndF ile) > 0 Then
Me![imagePath] = strPathAndFile
Me![productImage].Picture = strPathAndFile
Me!imagePathLin k = 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, strPathAndFileN ame, 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_Curren t

If Not Me!Thumbnail_Pa th = "" Or Not IsNull(Me!Thumb nail_Path)
Then
Me!ImageControl .Picture = GetPathPart & Me!Thumbnail_Pa th
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_Pa th

Thanks again,

Arnold

"Mike Storr" <no****@somewhe re.con> wrote in message news:<E_******* *************@n ews20.bellgloba l.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*******@eart hlink.net> wrote in message
news:18******** *************** **@posting.goog le.com...
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******@sympa tico.ca> wrote in message

news:<17******* ************@ne ws20.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*******@eart hlink.net> wrote in message
news:18******** *************** ***@posting.goo gle.com...
> 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, strPathAndFileN ame, 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_Curren t

If Not Me!Thumbnail_Pa th = "" Or Not IsNull(Me!Thumb nail_Path)
Then
Me!ImageControl .Picture = GetPathPart & Me!Thumbnail_Pa th
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_Pa th

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!ImageContro l.Picture", you are to replace the "ImageContr ol"
with the name of the image control you are using and Me!Thumbnail_Pa th 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
2051
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 error when trying to hit one of my pages... --------------------------------------------------------------------- Invalid URI: There is an invalid sequence in the string. ---------------------------------------------------------------------
6
3483
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 2 subforms that also show linked thumbnails. When the user initially selects a jpeg from the Windows API Common Dialog Control, the image needs to immediately appear. I have the following code on the main form:
1
2023
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
2520
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 upload to the folder 'Images' and newly selected image would overwrite existing image 'Logo.jpg'. (Image name remains same and image changes). The image control on my page doesn't refresh the newly selected image. it displays the old image where as the...
5
2559
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 problem is that i am not able to get the latest image on the page, it keeps showing the old page. But when i hit the refresh button on the toolbar it correctly gets the latest image and displays it in the control. But that has another problem, it...
1
9513
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 control. The problem jpgs were originally created as line drawings in Word. They were then copy and pasted to Paint where they were saved as jpg files. Sizemode is set to stretch.(have tried clip and zoom but no better). I cannot find any way to...
0
1193
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 the image in it's page_load and ultimately writes it to Response.OutputStream. In IE6, each time I cause a postback, the image is updated as I would expect. In firefox, the image does not get updated on postback until I force a refresh on the...
3
4763
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
1417
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 time I need to refresh or replace a Usercontrol, the redraw is doing very TOO slow and there some flickering... I try to activate the double buffering but without success. Same refresh speed.
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.