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

Help needed with picture box problem

11
I am trying to pass a variable containing the name of an image into the loadpicture method of a picture box. As I wish to do this with various different images I cannot enter the literal name of the image. So far I have been unable to do this, so help is needed.

Flinty
Jan 26 '13 #1
8 1219
Rabbit
12,516 Expert Mod 8TB
It would help to see the code.
Jan 26 '13 #2
Flinty
11
Expand|Select|Wrap|Line Numbers
  1. Private Sub lstTrophy_Click()
  2. Dim FilName
  3.     lstWinners.Clear 
  4.     txtHistory.Text = ""
  5.     Aname = Trim(lstTrophy.Text) 
  6.     FilName = "C:\TrophyPics\Aname"
  7. 'Show picture of trophy.
  8. pic1.Picture = LoadPicture(FilName)
  9.  
  10. End Sub
  11.  
Run time Error 53
File not found
Jan 27 '13 #3
Rabbit
12,516 Expert Mod 8TB
Your FilName variable contains no picture file.
Jan 28 '13 #4
Flinty
11
Sorry, I did not explain that AName is a global variable and holds the image name contained in the listbox.text value. Then FilName is the complete path of the directory and the image name. I have tried various combinations of variables and just using the listbox.text value, all to no avail.
Jan 28 '13 #5
Rabbit
12,516 Expert Mod 8TB
Like I said in my first post. Your FilName variable doesn't contain the image name. You say it contains the image name. But it doesn't. At least not in the code you're showing me. If you're showing me code that is different from what you're using, there's no way for me to help you.
Jan 28 '13 #6
Flinty
11
Rabbit,
I am sorry if you cannot follow my code. The names of the images are held in a listbox(lstTrophy). The images themselves are located in a folder named TrophyPics in the root C directory. When the user clicks on a name in the listbox, the image of that name is meant to show in the picturebox(pic1). That's about as simple as I can make it. Thanks for your continued attention.
P.S. I am aware it's a bit clunky and I may modify it to use a different method of storing images.
Jan 28 '13 #7
Rabbit
12,516 Expert Mod 8TB
I have no trouble following your code. The problem is that your explanation of the code does not follow your code. You say the FilName has the image name in it.

Here is your code
Expand|Select|Wrap|Line Numbers
  1. FilName = "C:\TrophyPics\Aname"
It clearly does not contain an image name. If you are attempting to append the value of your Aname variable, that is not how you do it. Variables do not auto expand in strings. If you want to concatenate the value of the variable, you need to do this:
Expand|Select|Wrap|Line Numbers
  1. FilName = "C:\TrophyPics\" & Aname
Jan 28 '13 #8
Flinty
11
Rabbit,
Thank you for that. A simple & operator was all it took. Lesson learned as I wasn't aware it was needed!
Jan 28 '13 #9

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

Similar topics

6
by: Sims | last post by:
Hi, Given a string $txt and an array of strings $txt_array what would be the best/fastest way to search in _insensitive_ case if $txt is in $text_array and, if it is, where is it? Because I...
2
by: Jack Smith | last post by:
Can someone help me out with this problem. Any help is appreciated. Thanks. Let doubleswap(x) be the string formed by replacing each a in x by the substring bb and each b by the substring aa....
6
by: Jack Smith | last post by:
Help needed on this question. Any help is appreciated. Thanks in advance. Given a binary string (i.e. a finite sequence of 0's and 1's) we choose any two digit substring 01 and replace it by a...
0
by: Gonçalo Rodrigues | last post by:
Hi, I have a problem with threads and sockets. I'll try to describe the problem in words with pseudo-code. I've been working on a few classes to make it easier to work with threads. This...
2
by: Ramki | last post by:
Hi, I want to call a PERL program from MS-DOS batch file. Following is just an example, the string may inturn have double quote or single quote. I can't call with arg1, arg2 etc, as the input...
1
by: worzel | last post by:
Hi All, I am looking for a reg ex that will match email addresses withing <a href=mailto blah > links. Actually, I already crafted my own, but with a slight problem: <a...
0
by: Francois | last post by:
Using VBdotNET and NET Framework 1.1 Problem: When I run the application in the Visual Studio IDE the display on the GUI is normal. When I package and deploy the software, after installation,...
3
by: batista | last post by:
Hi there, My problem is that, i've created a simple hello world web service project, and then, when i run it to test the operation,the invoke button does not open any window. I mean there is...
1
by: Joel Fireman | last post by:
Help Needed: Upgrade Fedora 4 / Apache 2 to PHP 5.2.x from 5.0.4 I've been testing Joomla as a content manager for the County offices, and it looks pretty good. Unfortunately, I decided to...
11
by: A.C. | last post by:
hi i m declaring a structure globally & there is func1 & main. i m assigning the value to variable(this is a pointer) of structure in fun1 & want to print it in main. this is same kind of...
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
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:
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
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
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,...
0
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...

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.