473,395 Members | 1,999 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,395 software developers and data experts.

Linking/Embedding Images

How do I reference images so the program will run on another computer?

Right now, I'm using this...

Dim myBitmap As New Bitmap(imagepath & "cat.jpg")
image1.Image = myBitmap

The problem is "imagepath" is a hardcoded directory path to where "cat.jpg" is stored on my hard disk. When I send the program to another computer, it of course, can't find the images.

Also, is there a way to imbed images in with the exe file?
Jul 5 '07 #1
5 1609
Killer42
8,435 Expert 8TB
Disclaimer: I'm speaking from a VB6 perspective, don't know what version you're using.



Sure, just load the image into the picturebox or imagebox control at design time. It will be stored in the EXE, and won't need to be loaded froma separate file at run time.
Jul 6 '07 #2
Right, that would work, but I have picture boxes that I use to display different images depending on what is happening.

I'm working on a simple rock-paper-scissors game. I have a picture box that displays an image of what the player selects. So the image can be of a rock, or paper, or scissors.
Jul 6 '07 #3
Killer42
8,435 Expert 8TB
Right, that would work, but I have picture boxes that I use to display different images depending on what is happening.

I'm working on a simple rock-paper-scissors game. I have a picture box that displays an image of what the player selects. So the image can be of a rock, or paper, or scissors.
Well, there are a number of ways you can handle that. Two fairly simple methods that come to mind are:
  1. Have three different images, all hidden. Then just make the appropriate one visible.
  2. Have three invisible images, and one visible one where you copy the one you want to display. You can do that just by assigning Picture1.Picture = Picture2.Picture. (Or possibly the Image property, I always forget.)
Jul 6 '07 #4
Thank you for the help!

I hadn't thought about loading the images into picture boxes and turning off their visibility.

That seems to have fixed it.

Many thanks!
Jul 6 '07 #5
Killer42
8,435 Expert 8TB
Glad to help. :)
Jul 8 '07 #6

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

Similar topics

2
by: dr_tyson | last post by:
I am trying to embed images into a wxPython app (created using Boa Constructor), but have not been able to do so. I know how to embed plots, but images seem to be a problem. I've tried using code...
6
by: theo.bruening | last post by:
Hello all. I hope someone can help me here. I need to make a db on many pictures, however, if I OLE them, the access database grows hugely. If I only hyperlink them, I can't view them. is there...
5
by: chrisse_2 | last post by:
Hi, All the records in my database will contain at least one picture. At the moment all the images are part of the database as ole objects although the database is way to big and there is only...
6
by: Edward | last post by:
I have been doing some research about embedding images in HTML using the data URL src method of the format: <img src="/-/data:image/gif;base64,<DATA>"> My question is, how does one generate...
1
by: MissMarie | last post by:
I've been playing around with DIV tables in myspace to better learn how to rewrite my own code for my business site without having to pay someone to design it. I've tried embedding a slideshow into...
4
by: Ram Shriram | last post by:
My C++ project takes 45-60 minutes for linking, with link.exe taking up 100% of the CPU. I am using: Microsoft Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200) Microsoft Visual C++...
0
by: macap.usenet | last post by:
Hello, i am embedding System.Web.UI.WebResources in my C# Class via: I use this resource with: Page.Header.Controls.Add(new LiteralControl("<link href='"ExtJS.yui- ext.css"'...
0
by: DevEng | last post by:
Hi all, I am new to Python and trying to embed it into a c/c++ application. I started with examples from the documentation pages and go to the Pure Embedding example...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.