We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,586 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Open Button Help

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

3
Contributors
4
Replies
12 Hours
Discussion Span
4 Months Ago
Last Updated
6
Views
Question
Answered
IsaacMessi10
Light Poster
43 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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.

tinstaafl
Nearly a Posting Virtuoso
1,481 posts since Jun 2010
Reputation Points: 429
Solved Threads: 261
Skill Endorsements: 14

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

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

IsaacMessi10
Light Poster
43 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

G_Waddell
Practically a Master Poster
623 posts since Nov 2009
Reputation Points: 107
Solved Threads: 95
Skill Endorsements: 6

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

Dude it's perfect thanks.

IsaacMessi10
Light Poster
43 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Month Ago by G_Waddell and tinstaafl

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0688 seconds using 2.67MB