Results 1 to 9 of 9

Thread: [RESOLVED] How to navigate a webbrowser only from a button?

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    16

    Resolved [RESOLVED] How to navigate a webbrowser only from a button?

    Hi, I am extremely new to Visual Basic, and I have only so far made an e-mail sender and an SMS sender (through e-mail).

    So I am having troubles, I made a quick Web browser that I only want to show one page when you press a button ( you have to enter a name into a textbox and it will then make the URL to show), but the page has some links on it, which I don't want people to click on. I came up with a couple of solutions to my problem, which I don't even know if some of them are possible...
    1) Disable the hyperlinks
    2) Disable left clicks in the browser
    3) Make the browser somehow only visible and not actually interactive with a mouse

    I honestly have been searching for hours for a solution and also trying different things, but to no avail.

    So my question is are any of those three options possible? If not then what is an alternative? If so then which would be easiest and how would I go about doing so?

    Thanks for your time.

    Here is what I have in total:
    Code:
    Public Class Form1
        Private Sub TextBox1_keypress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
            If Asc(e.KeyChar) = Keys.Enter Then
                WebBrowser1.Navigate("http://firstpartoftheURL/" + TextBox1.Text + "secondpartoftheURL.html")
                e.Handled = True
            End If
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            WebBrowser1.Navigate("http://firstpartoftheURL/" + TextBox1.Text + "secondpartoftheURL.html")
        End Sub
    
    End Class
    I tried something like
    Code:
        
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            WebBrowser1.AllowNavigation = True
            WebBrowser1.Navigate("http://firstpartoftheURL/" + TextBox1.Text + "secondpartoftheURL.html")
            WebBrowser1.AllowNavigation = False
        End Sub
    Which I assumed would allow navigation once you clicked the button, but would then not allow it once you are done clicking it, but it just stays at false.
    Last edited by iambowling247; Aug 7th, 2009 at 05:20 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width