473,396 Members | 2,013 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,396 software developers and data experts.

Adding Image with Command Button

FyrJammer
I apologize if there is already a discussion about this, but I don't have a lot of time looking for it.
I need to create a command button that opens explorer to search for images to add / put into / pastes to form / bound frame. It's a database for adding pictures to property inspection form. If anyone has or knows where I can find the codes for doing such a process please let me know. I really appreciate any help.
Mar 1 '07 #1
8 12412
MMcCarthy
14,534 Expert Mod 8TB
I apologize if there is already a discussion about this, but I don't have a lot of time looking for it.
I need to create a command button that opens explorer to search for images to add / put into / pastes to form / bound frame. It's a database for adding pictures to property inspection form. If anyone has or knows where I can find the codes for doing such a process please let me know. I really appreciate any help.
Something like this will give you a get file window and return the full path to the file which can then be set to the frame.

Expand|Select|Wrap|Line Numbers
  1. Dim sFilename as String
  2. sFilename = Application.GetOpenFilename("Image Files (*.bmp),*.bmp, (*.tif),*.tif, (*.jpg),*.jpg")
  3. ' To Exit if Cancel was pressed
  4. If sFilename = "False" Then Exit Sub
  5. >
  6. >
  7.  
Mary
Mar 2 '07 #2
Something like this will give you a get file window and return the full path to the file which can then be set to the frame.

Expand|Select|Wrap|Line Numbers
  1. Dim sFilename as String
  2. sFilename = Application.GetOpenFilename("Image Files (*.bmp),*.bmp, (*.tif),*.tif, (*.jpg),*.jpg")
  3. ' To Exit if Cancel was pressed
  4. If sFilename = "False" Then Exit Sub
  5. >
  6. >
  7.  
Mary
Thanks Mary, but is this code for my command button? I get a 'Method not recognized' error with the Application.GetOpenFilename part of the code. Attached you will find a part of the program I'm working on. The image box is where the image is going to be viewed (stored in database). I'm sorry for sounding too noobie, but I'm having a hard time figuring out how to make my button choose and save the image. The images will be relationed to specific addresses and I need to make each address have 2 images (Image1 and Image2).
Is there a way you or anyone can help me with this? Much appreciated.
Mar 3 '07 #3
Thanks Mary, but is this code for my command button? I get a 'Method not recognized' error with the Application.GetOpenFilename part of the code. I have an image box where the image is going to be viewed (stored in database). I'm sorry for sounding too noobie, but I'm having a hard time figuring out how to make my button choose and save the image. Saving it as BLOB seems a little confusing to me.
The images will be relationed to specific addresses and I need to make each address have 2 images (Image1 and Image2).
Is there a way you or anyone can help me with this? Much appreciated and thanks in advance.
Mar 3 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Thanks Mary, but is this code for my command button? I get a 'Method not recognized' error with the Application.GetOpenFilename part of the code. I have an image box where the image is going to be viewed (stored in database). I'm sorry for sounding too noobie, but I'm having a hard time figuring out how to make my button choose and save the image. Saving it as BLOB seems a little confusing to me.
The images will be relationed to specific addresses and I need to make each address have 2 images (Image1 and Image2).
Is there a way you or anyone can help me with this? Much appreciated and thanks in advance.
You are probably missing a library for the Application.GetOpenFilename. However, it sounds like you want to store the images in the database which is not what the first question said. You can link to the images using an OLE Object datatype. Create a field and set to OLE Object and follow the wizard to set it up. Link, don't embed the files.

Mary
Mar 3 '07 #5
You are probably missing a library for the Application.GetOpenFilename. However, it sounds like you want to store the images in the database which is not what the first question said. You can link to the images using an OLE Object datatype. Create a field and set to OLE Object and follow the wizard to set it up. Link, don't embed the files.

Mary
Oh, Ok. But yes, I do NEED to store the images to the database in a table because the whole database is going to be mobile via thumbdrive. My apologies for not specifying that earlier. And thanks.
Mar 8 '07 #6
i have the same situation with you .i 've just known that we have OLE bound frame on form and OLE object in database .User could insert image by right-click this control but i'm not sure it add to the right id in database .So if you have find out the way to do ,please mail to me, [email removed]. Thanks!
Mar 9 '07 #7
svill
1
I am struggling quite alot here to set the picture of an OLE object. I do have some Visual Basic experience so please dont hesitate to hit me with the technical information.

On my continous form i would like to set the OLE picture with a command button.
Intentionally there will be an open-save dialog box. But just to the raw code here to do the core function. I have not read any articles on it but this code seems to work. It only adds the icon of a bitmap file, and not the actual picture in OLE.


Me.PicturePrev.Class = "Paint.Picture"
Me.PicturePrev.OLETypeAllowed = acOLEEither
Me.PicturePrev.SourceDoc = "C:\1.bmp"
Me.PicturePrev.Action = acOLECreateEmbed
Me.PicturePrev.SizeMode = acOLESizeZoom


Please help
Aug 25 '08 #8
FishVal
2,653 Expert 2GB
Hello, all.

The most efficient way to store files (documents, pictures etc) inside database is using BLOB. There is an article in bytes.com howto's section dealing with the issue.

Kind regards,
Fish
Aug 25 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: midtoad | last post by:
I'm trying to display a GIF image in a label as the central area to a Tkinter GUI. The image does not appear, though a space is made for it. Why is this so? I notice that I can display a GIF...
2
by: kowald | last post by:
Hi everybody, I'm just getting into Tkinter and try to create a button that displays an image instead of text. I do something like: >tmp = PhotoImage(file='start.gif') >buttonStart =...
0
by: Andrés Giraldo | last post by:
Hi! I'm adding an asp button to a datagrid on the ItemDataBound event, when the user clicks on this button, I basically remove the button and create other 2 buttons... my problem is.. the 2 last...
16
by: Picho | last post by:
Hi all, Is there any .NET way (I am not rulling out API usage) to add button(s) to a form's title bar? I found some non-.NET solutions that did actually work in VB6 but not in the ..NET...
1
by: seanmayhew | last post by:
I have a form page that that while editing saves the data to an xml doc before submitting to db. On each page unload it saves the xmldoc as the user can add multiple items to the company like...
1
by: xanthviper | last post by:
Hey there, I'm kind of stumped on this and hopefully someone can guide me in the right direction. I have a webform that I am developing in C# using ASP.NET 2.0. On the page_load, I am...
4
by: John Smith | last post by:
I have a continuous form. there is a command button with the following code for the OnClick event: DoCmd.OpenForm "frmPlants", , , "PlantsID =" & Me!PlantsID I click the button and frmPlants...
9
by: Mark Denardo | last post by:
This is related to another post I submitted, but I'll be more precise this time. I have a web page that contains an Image webcontrol that loads its image by: Image1.ImageUrl="<username>.jpg",...
2
by: RussCRM | last post by:
I want to use a command button, say "cmdDisplayImage" to display/ transfer a captured image from the ezVidCap1 control to an image or OLE box on the same form such as "PhotoPreview" (not sure...
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
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...
0
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,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.