Results 1 to 3 of 3

Thread: [RESOLVED] Image and My.Settings - Please help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    115

    Resolved [RESOLVED] Image and My.Settings - Please help

    Hi all

    Can anyone help me to solve this problem.

    In my application I have two forms, the main application form and a second form, containing a number of images, allowing me to choose a background image tile for the main form.

    I would like to store the full image path in a my.settings string so that when the application is run again the chosen background image is loaded automatically.

    My problem is that the images on the second form are from my.resources. If I try code such as:
    Code:
    My.Settings.selectedbackground = My.Resources.BlueSilk9
    I get the following error:
    Code:
    Value of type 'System.Drawing.Bitmap' cannot be converted to 'String'.
    How can I get the full path of an image stored in my.resources which I could then place into my setting?

    Thanks in advance.
    Regards
    Colin

    If my comments helped please remember to add to my reputation using Rate This Post.

    If your problem has been resolved please mark the thread resolved using the "Mark Thread Resolved" link in thread tools.

    CodeBank Submissions: 1) WebBrowser - Delete cookies etc 2) Import My.Settings from previous build version

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Image and My.Settings - Please help

    You can't. You talk about paths, which implies files, but resources aren't files. They are binary data embedded in your EXE. If you have your images embedded as resources then I'd suggest storing a number in My.Settings. You can then use a Select Case statement to determine which resource to retrieve based on that number.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    115

    Re: Image and My.Settings - Please help

    Thanks jmc for replying.

    That is exactly the route I ended up taking. However, it was so late when I got finished working on it last night that I didn't have time, and was too tired, to report back on forum.
    Regards
    Colin

    If my comments helped please remember to add to my reputation using Rate This Post.

    If your problem has been resolved please mark the thread resolved using the "Mark Thread Resolved" link in thread tools.

    CodeBank Submissions: 1) WebBrowser - Delete cookies etc 2) Import My.Settings from previous build version

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width