[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.
Re: How to navigate a webbrowser only from a button?
Hmm Donno. Answered but then i read the end :P
Actually i tried same in 1 hour ago :P
Re: How to navigate a webbrowser only from a button?
Quote:
Originally Posted by
Zeuz
Hmm Donno. Answered but then i read the end :P
Actually i tried same in 1 hour ago :P
I'm sorry man, but I have no idea what you just said, haha.
Re: How to navigate a webbrowser only from a button?
put the wb control in a panel and disable the panel
Re: How to navigate a webbrowser only from a button?
Quote:
Originally Posted by
stateofidleness
put the wb control in a panel and disable the panel
If you are talking about the design form then I just tried that and it just covers the webbrowser so than I can't see it, then I set the visibility to false and it then just lets me click everything in the webbrowser...
Re: How to navigate a webbrowser only from a button?
put the webbrowser IN the panel and set it's "Enabled" property.. not its "Visible" property
Re: How to navigate a webbrowser only from a button?
Quote:
Originally Posted by
stateofidleness
put the webbrowser IN the panel and set it's "Enabled" property.. not its "Visible" property
I did both to try them out, but I just got it, I had the panel on top of the browser, haha, thank you so much! Such a simple fix to something I have spent almost a whole day trying to fix!
Re: How to navigate a webbrowser only from a button?
good deal. rep if you feel like it and mark thread resolved!
glad you got it working
Re: How to navigate a webbrowser only from a button?
Click on here to mark this thread resolved.
Mark Thread Resolved