Private Sub Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Open.Click
        If (BookmarksList.SelectedIndex >= 0) Then
            WebBrowser.WebBrowser1.Navigate(BookmarksList.SelectedItems)
        End If
End Sub

This is the code I made for opening a Bookmark from List yet an error keeps on showing. Any help?

WebBrowser is the main form's name.
BookmarksList is the List Box that contains the Bookmarks.

PS: I've just started to learn VB.NET

Recommended Answers

All 4 Replies

When the error shows up, make note of the line it's on. That information is usually pretty important. Off the top of my head, I'd say try SelectedItem.Text instead of SelectedItems.

I've changed it as you told me to and diplayed this error:

Public member 'Text' on type 'String' not found.

Hi,

WebBrowser.WebBrowser1.Navigate(BookmarksList.SelectedItems)

SelectedItems implies a collection to me - did intellisense highlight it?

I'd say your looking for either

WebBrowser.WebBrowser1.Navigate(BookmarksList.SelectedItem)

Or

WebBrowser.WebBrowser1.Navigate(BookmarksList.SelectedItems(0))

However, given the error message when you tried SelectedItem.Text is telling you text is not a valid member on type string I'd say the first option is the one you want i.e. SelectedItem

WebBrowser.WebBrowser1.Navigate(BookmarksList.SelectedItems(0))

Dude it's perfect thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.