PureSc0pe Posted July 18, 2004 Posted July 18, 2004 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... Quote It's not impossible, it's Inevitable.
Administrators PlausiblyDamp Posted July 18, 2004 Administrators Posted July 18, 2004 What is the contents of the string that the line ini3.Readstring(Listbox1.SelectedItem, "Icon") returns? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
PureSc0pe Posted July 19, 2004 Author Posted July 19, 2004 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... Quote It's not impossible, it's Inevitable.
Arch4ngel Posted July 19, 2004 Posted July 19, 2004 ListBox1.BackgroundImage = System.Drawing.Image.FromFile(ini3.Readstring(Listbox1.SelectedItem, "Icon")) will it work ? Quote "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
PureSc0pe Posted July 19, 2004 Author Posted July 19, 2004 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... Quote It's not impossible, it's Inevitable.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.