In VB4 I have a form, a FileListBox (which includes some jpg pictures), an Image and a TextBox.
With a click in the name of any picture in the FileListBox, the picture appears in the Image.
(I use the command:
f$ = File1.Path + "\" + File1.filename
image1.Picture = LoadPicture(f$)
How could I, for any picture I load, a certain text to be displayed in the TextBox? (Which will describe the picture).  
I would not like to use the «ListIndex», because the order and the number of the pictures will be change from time to time.  
What I want is when the picture (city.jpg for example), is loaded, a certain text for this picture to be displayed.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Humm.. you have the filename in File1.filename don't you? Code like this should do it

Select Case Ucase$(File1.filename)
  Text1.Text = "A city.. or something"
<add more case statements here>
End Select

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you want to be able to change your text without recompiling your program, you can put your text in an ASCII file or a database.  Key the file with the name of the JPG file...

Then all you have to do is read the file or database...

For example, in a file, you could have the following lines:

   CITY.JPG:A city.. or something
   STATE.JPG:A state.. or something

Then you could read the file and split the record read into fields and test the fields, like in this function:

function GetText(Filename as string) as string
dim fnum as long
dim buf as string
dim ival as integer
dim arg1 as string
dim arg2 as string
open "myfile" for input access read as #fnum
do while not eof(fnum)
   line input #fnum, buf
   if Filename=arg1 then
      exit do
   end if
close fnum
end function

Got a sample project on my web page that pulls up images and text from an Access database. Visit www.cyberchute.com/rvbus/madmark

oteAuthor Commented:
I accept the simple answer of VBmaster.
That was what I needed!
I'll keep the valuable answer of mcrider for some next effort of mine.
Glad I could help...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.