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

Web Browser Help

    Private Sub RefreshGoSearchCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshGoSearchCancel.Click
        If (AddressBar.Text = "") Then
            WebBrowser.Refresh()
        ElseIf (AddressBar.Text <> "" And "." And "") Then
            WebBrowser.Navigate("www.google.com/search?q=" & AddressBar.Text)
        Else
            WebBrowser.Navigate(AddressBar.Text)
        End If
    End Sub

This is the code for The AddressBar to refresh when text hasn't changed, search when there is no website prefix and navigate to a web address when ther is. A runtime error is showing up any help?

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

ElseIf (AddressBar.Text <> "" And "." And "") Then

You will have to write it like this

ElseIf (AddressBar.Text <> "" And AddressBar.Text <> ".") Then

you were comparing string only once.

Sahil89
Posting Whiz in Training
200 posts since Sep 2011
Reputation Points: 10
Solved Threads: 22
Skill Endorsements: 1

thanks
noob mistake

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

I'd say the best way to handle the address bar text is using Regular Expression.

Or if just want to check if it's a valid URI, use this: Uri.IsWellFormedUriString(YourURLString, UriKind.RelativeOrAbsolute)

AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0958 seconds using 2.66MB