none
navigating selected list view item RRS feed

  • Question

  • Hello all,

    I'm currently creating a tabbed browser. Everything works fine as i expected. When it comes to history, I'm excepting a difficulty to navigating items from list view. Any help will be appreciated and credited.

    Thanks in advanced,

    Kenny

     

    Thursday, February 24, 2011 11:15 AM

Answers

  • Looks like you have similar question here related to Listview & Webbrowser, but not about navigating to a website whose URL is in listview. Assuming you want to navigate to the link which exists in listview as currently selected item, you can simply do:

      Private Sub ListView1_SelectedIndexChanged _
        (ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
    Handles ListView1.SelectedIndexChanged
            If ListView1.SelectedItems.Count > 0 Then
                WebBrowser1.Navigate(ListView1.SelectedItems.Item(0).Text)
            End If
        End Sub

    Note: Make sure your Listview's items' have proper Text property formed as valid URLs and ensure that"MultiSelect" property is False not to navigate multiple pages on each item click.

    HTH.


    Best regards, Saygılarımla, Onur Güzel

    Yazgeliştir Forumları'ndayım.

    Microsoft Haber Grupları Profilim (VB.NET)

    Thursday, February 24, 2011 9:32 PM

All replies

  • Hello all,

    I'm currently creating a tabbed browser. Everything works fine as i expected. When it comes to history, I'm excepting a difficulty to add visited url to listview control. Any help will be appreciated and credited.

    Thanks in advanced,

    Kenny

     

    Thursday, February 24, 2011 11:06 AM
  • Hi Kenny,

    Can you give us your code if you already tried something ?

    I suppose you are using a normal WebBrowser control,

    You can retrieve the current link by getting the value of Webbrowser.Url.AbsoluteUri. You can also and for example add every visited link in a list (Of String) and check if the current link is already in the list or not.

    When the DocumentCompleted event is fired, you can try something like this :

     ListView1.Items.Add(WebBrowser1.Url.AbsoluteUri)
    

    Your problem may comes from the multiple tabs ?

    If it's the case, i suggest you to create a global list who add/check every link and then your listview is completed from this list.


    Thursday, February 24, 2011 11:52 AM
  • Looks like you have similar question here related to Listview & Webbrowser, but not about navigating to a website whose URL is in listview. Assuming you want to navigate to the link which exists in listview as currently selected item, you can simply do:

      Private Sub ListView1_SelectedIndexChanged _
        (ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
    Handles ListView1.SelectedIndexChanged
            If ListView1.SelectedItems.Count > 0 Then
                WebBrowser1.Navigate(ListView1.SelectedItems.Item(0).Text)
            End If
        End Sub

    Note: Make sure your Listview's items' have proper Text property formed as valid URLs and ensure that"MultiSelect" property is False not to navigate multiple pages on each item click.

    HTH.


    Best regards, Saygılarımla, Onur Güzel

    Yazgeliştir Forumları'ndayım.

    Microsoft Haber Grupları Profilim (VB.NET)

    Thursday, February 24, 2011 9:32 PM
  • thanks, sorry about the post.

    i ment to edit it and somehow instead i got 2 posts.

    Kenny,

    Friday, February 25, 2011 12:11 AM