Results 1 to 7 of 7

Thread: Listbox Favourites

  1. #1

    Thread Starter
    Fanatic Member Emcrank's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Listbox Favourites

    Ok i am on my webbrowsers favourites, and im looking to use a listbox so the user can have as many as they want. Also i want the listbox to show the Site Title, like so it just shows the title of that website. But then i wouldn't know how to navigate to that website if just the title is in the listbox How would i do this?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Listbox Favourites

    This is easily accomplished by having the title linked to the URL.

    The listbox is not going to store your favorites...it is only going to display what has already been stored. Where are you actually storing them?

  3. #3

    Thread Starter
    Fanatic Member Emcrank's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Re: Listbox Favourites

    What do you mean? What im doing is on favourite add button i want to add a favourite with the site title to the listbox but i dont know how to get the listbox to store the URL for that favourite because i dont want the URL in the listbox.

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

    Re: Listbox Favourites

    You can bind a list of any type of objects to a ListBox and then use the DisplayMember to specify which column/property of the items to display.

    What Hack is saying is that the ListBox will display your data while the app is running but as soon as the app exits the ListBox ceases to exist so it can't help you then. If you expect your data to be persisted between sessions then you must be saving it somewhere. Where? How? In what format?
    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

  5. #5

    Thread Starter
    Fanatic Member Emcrank's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Re: Listbox Favourites

    Quote Originally Posted by jmcilhinney View Post
    You can bind a list of any type of objects to a ListBox and then use the DisplayMember to specify which column/property of the items to display.
    How would i do this?, and dam yea how would i save each favourite as a new one is added into an .ini file because i have a settings.ini already for the application.

  6. #6

    Thread Starter
    Fanatic Member Emcrank's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Re: Listbox Favourites

    Ok i see that in the designer there is DisplayMember and a Value member , im guessing the display would be the Webpage title and the value be the URL but how do i sort it out to save each of these?

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

    Re: Listbox Favourites

    There are various ways. You could use multiple StringCollections in My.Settings. You could put all the data into a single String with delimiters between each pair of values and records. The String could then be saved to My.Settings or a text file or whatever. You might also create a list of objects with the appropriate properties and then serialise that list. The choice is yours.
    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

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