dcsimg
Results 1 to 19 of 19

Thread: [RESOLVED] Bookmarks Bar like Chrome in Visual Basic

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    Resolved [RESOLVED] Bookmarks Bar like Chrome in Visual Basic

    SOLUTION

    Upon pressing the Bookmarks button, I passed a value to a public variable of frmBookmarks (callingForm), that value was "Me".

    Then, whenever I pressed Add Bookmark, I passed that same value over to frmAdd, and then when closing frmAdd, I passed it back to frmBookmarks.

    Then, when I called frmTab.UpdateBookmarks(), I also did,

    DirectCast(callingForm, frmTab).UpdateBookmarks()
    Last edited by Reboh79; Jun 13th, 2015 at 06:06 AM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,871

    Re: Bookmarks Bar like Chrome in Visual Basic

    I don't use Chrome but I imagine that all the commonly-used browsers are the same in that regard. In a WinForms app you would simply use a ToolStrip. The Items property is a collection and it has a Add method, so you can add items at run time with that. You'll probably want to use the overload that takes a String, an Image and an EventHandler for the Click event. The item returned has a Tag property that you can assign the full URL to and then get that back in the event handler.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:12 AM. Reason: Redacting content

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,871

    Re: Bookmarks Bar like Chrome in Visual Basic

    Quote Originally Posted by Reboh79 View Post
    This is a problem, and I yet again need to enlist the forum's help in solving it.
    And what would that problem be exactly?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:12 AM. Reason: Redacting content

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,871

    Re: Bookmarks Bar like Chrome in Visual Basic

    I don't know how to retrieve a favicon but I know what I'd do if I wanted to know:

    http://www.bing.com/search?q=retrieve+favicon+vb.net

    Once you've got the icon, you can store it as base-64 text, allowing you to store it in the same file as your other data. Check this out:

    http://www.vbforums.com/showthread.p...and-Back-Again

    Note that the Icon class has a Save method too.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:13 AM. Reason: Redacting content

  8. #8
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: Bookmarks Bar like Chrome in Visual Basic

    tlsBookmarks.Items.Add(bookmarkDetails(0), Nothing, AddressOf Bookmark_Click).Tag = bookmarkDetails(1)

    If that compiles, I can't believe that it does what you think it does. And if it does what you think it does I still can't believe it!

    As with all display problems, the first thing to try is Refresh for the control just to make sure that it's not failing to Paint for some reason. After that it's not really much use simply counting the items, you need to make sure that they are actually displayable items (my suspicion is that they're not if what I think the line above does is what it does) so you probably need to whack in a breakpoint and see what they are.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  9. #9
    Super Moderator Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Bookmarks Bar like Chrome in Visual Basic

    Quote Originally Posted by dunfiddlin View Post
    tlsBookmarks.Items.Add(bookmarkDetails(0), Nothing, AddressOf Bookmark_Click).Tag = bookmarkDetails(1)

    If that compiles, I can't believe that it does what you think it does. And if it does what you think it does I still can't believe it!
    It should work, one of the overloads of the ToolStrip.Items.Add methods takes the arguments Text, Image, OnClickEventHandler and it returns the ToolStripItem it just added so you should be able to call the Tag property on the return value.
    Joacim Andersson
    If anyone's answer has helped you, please show your appreciation by rating that answer.
    I'd rather run ScriptBrix...
    Joacim's view on stuff.

    MVP

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:13 AM. Reason: Redacting content

  11. #11
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,871

    Re: Bookmarks Bar like Chrome in Visual Basic

    My suspicion is that this issue has something to do with the default instance of your form containing the ToolStrip. I suspect that you're making changes to the default instance while viewing an instance that you explicitly created or vice versa. If so then this is an example of why many of us more experienced developers don't like default instances: they create as many issues as they solve. If you're not sure what a default instance is then follow the Blog link in my signature below and check out my post on the subject. You should then be able to determine whether my suspicions are correct and, if you still can't solve the issue, post back with more specific information.

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:13 AM. Reason: Redacting content

  13. #13
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,871

    Re: Bookmarks Bar like Chrome in Visual Basic

    Whether or not you use Show is irrelevant. That's how you show a form whether it's the default instance or not. The difference between the default instance and another is whether you access it via the class name directly or you create an instance explicitly with the New keyword.

    It's also important to note that if you show a form by calling its Show method and then close it then you dispose that form, meaning that it can't be shown again. If you access the default instance, close it and then access it again, it will actually be a different instance the second time. The first instance would be disposed when you closed it so an new default instance would be automatically created the second time. Perhaps that's what's happening in your case.

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:13 AM. Reason: Redacting content

  15. #15
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,871

    Re: Bookmarks Bar like Chrome in Visual Basic

    If you just put a Button on that form and, instead of opening the bookmarks form, you clear the ToolStrip and add some arbitrary items, does that work?

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:13 AM. Reason: Redacting content

  17. #17
    Super Moderator Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Bookmarks Bar like Chrome in Visual Basic

    So if this thread is resolved could you please click on the Mark Thread As Resolved in the Thread Tools menu above your original post?
    Joacim Andersson
    If anyone's answer has helped you, please show your appreciation by rating that answer.
    I'd rather run ScriptBrix...
    Joacim's view on stuff.

    MVP

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Jan 2011
    Posts
    28

    redacted

    redacted
    Last edited by Reboh79; Jun 13th, 2015 at 06:14 AM. Reason: Redacting content

  19. #19
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,871

    Re: Bookmarks Bar like Chrome in Visual Basic

    Quote Originally Posted by Reboh79 View Post
    Sorry, I just appended my last post to ask another question! Figured it'd be better to ask here than to start a whole new thread.
    You figured wrong. One topic per thread and one thread per topic please. It just makes it harder for everyone if multiple topics are jumbled in together or a single topic is spread over multiple threads. Please mark this thread as Resolved and start a new thread with a title that describes the new topic.

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width