Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a Listbox and I need it to display a picture in the background of it in the middle. Whatever is selected in the Listbox...the image changes...It reads the file location of the image from an .ini file.

 

What I have does not work, can someone tell me the correct way...?

 

Listbox1.BackgroundImage = [u]ini3.Readstring(Listbox1.SelectedItem, "Icon")[/u]

 

That gives it the file location but I receive the following error to what is underlined and have no clue what to do...

 

Value of type 'String' cannot be converted to 'System.Drawing.Image'

 

How do I have the location string converted, I guess that's what I'm asking...

It's not impossible, it's Inevitable.
Posted
What is the contents of the string that the line

ini3.Readstring(Listbox1.SelectedItem, "Icon")

returns?

 

(ini3.Readstring(Listbox1.SelectedItem, "Icon") will read the file location of the image needed to display in the listbox.

 

So it basically ends up something like this:

 

Listbox1.BackgroundImage = C:\Program Files\Favorites\Image.jpg

 

It's reading that from the ini file...

It's not impossible, it's Inevitable.
Posted

ListBox1.BackgroundImage = System.Drawing.Image.FromFile(ini3.Readstring(Listbox1.SelectedItem, "Icon"))

 

will it work ?

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted
ListBox1.BackgroundImage = System.Drawing.Image.FromFile(ini3.Readstring(Listbox1.SelectedItem, "Icon"))

 

will it work ?

 

That gives me no errors in anything, however it does not make it the background image...

It's not impossible, it's Inevitable.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...