|
-
Aug 7th, 2009, 03:31 PM
#1
Thread Starter
Junior Member
[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.
-
Aug 7th, 2009, 03:55 PM
#2
Hyperactive Member
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
-
Aug 7th, 2009, 03:58 PM
#3
Thread Starter
Junior Member
Re: How to navigate a webbrowser only from a button?
 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.
-
Aug 7th, 2009, 04:01 PM
#4
Re: How to navigate a webbrowser only from a button?
put the wb control in a panel and disable the panel
-
Aug 7th, 2009, 04:05 PM
#5
Thread Starter
Junior Member
Re: How to navigate a webbrowser only from a button?
 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...
-
Aug 7th, 2009, 05:02 PM
#6
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
-
Aug 7th, 2009, 05:15 PM
#7
Thread Starter
Junior Member
Re: How to navigate a webbrowser only from a button?
 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!
-
Aug 7th, 2009, 05:16 PM
#8
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
-
Aug 7th, 2009, 05:31 PM
#9
Fanatic Member
Re: How to navigate a webbrowser only from a button?
Click on here to mark this thread resolved.
Mark Thread Resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|