• Log in or sign up for an account here: https://www.sythe.org/login

Webbrowser help

hampe-92

Forum Addict
Joined
Jul 10, 2008
Sythe Gold
0
Messages
328
Hi
I'm working on a litle webbrowser project to train my C# skills...
When i write something in the URL bar then I want to be able to just hit enter and the page will load.. but as it is now I have to go click the Go button which pretty much sucks... so, I would realy appreciate any help :)
I've googled it but I haven't found anything that I can get working...
Thx in advance!

EDIT: One more thing.. I can't get the progressbar to work... :S?
 
Homosex
well, you could lookup a sample visual basic web browser module and try to program around it in a C# environment. I'm not sure about the progress bar....
 
Homosex
well, you could lookup a visual basic web browser module and program around that in a C# environment. I can't help you with the progress bar at the moment....
 
Put this in the KeyPress event of the textbox:

Code:
     if (Strings.AscW(e.KeyChar) == 13) {
         WebBrowser.Navigate(txtURL.Text);
     }
 
Put this in the KeyPress event of the textbox:

Code:
     if (Strings.AscW(e.KeyChar) == 13) {
         WebBrowser.Navigate(txtURL.Text);
     }
hmm... can u explain what the (Strings.AscW part means? and what is 13?
 
Member of the Month Winner
Sythe's 10th Anniversary
hmm... can u explain what the (Strings.AscW part means? and what is 13?
Look in the KeyDown, KeyPress and KeyUp events of your textbox. Place the code for your button in to a method, then call that method from your desired events.
 
ok.. thx guys... I managed to figure it out... this is what I got
Code:
void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e) 
{ 
     if (e.KeyCode == Keys.Enter)
        {
            webBrowser1.Navigate(toolStripTextBox1.Text);
        }
}
and Swan, you're my idol :p
 
Homosex
Thats actually pretty good snippet you got there =)

Man, I need to brush up on my C#......
 
Member of the Month Winner
Sythe's 10th Anniversary
yea i know, but then u should use KeyPress, right?
but Enter makes more sence than 13...
Yes. The use of what is called "Magic numbers" is extremely bad practice.
 
i want to stop a pop up box that keeps commin up on webpages wen im using opera, it says the informaton of title, address, encoding & MIME type

can anyone help?
 
Member of the Month Winner
Sythe's 10th Anniversary
Runescape Gamblingrunescape gambling
Back
Top