Adblock breaks this site

Webbrowser help

Discussion in 'Programming General' started by hampe-92, Oct 10, 2008.

  1. hampe-92

    hampe-92 Forum Addict

    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0
    Webbrowser help

    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?
     
  2. exapto

    exapto #1 OSRS Magic Training Service
    $50 USD Donor New

    Joined:
    Oct 10, 2008
    Posts:
    645
    Referrals:
    0
    Sythe Gold:
    123
    Vouch Thread:
    Click Here
    Discord Unique ID:
    716746285151027321
    Discord Username:
    exapto#2360
    Homosex
    Webbrowser help

    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....
     
  3. exapto

    exapto #1 OSRS Magic Training Service
    $50 USD Donor New

    Joined:
    Oct 10, 2008
    Posts:
    645
    Referrals:
    0
    Sythe Gold:
    123
    Vouch Thread:
    Click Here
    Discord Unique ID:
    716746285151027321
    Discord Username:
    exapto#2360
    Homosex
    Webbrowser help

    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....
     
  4. PinBuyer_

    PinBuyer_ Active Member
    Banned

    Joined:
    Oct 10, 2008
    Posts:
    140
    Referrals:
    0
    Sythe Gold:
    3
    Webbrowser help

    Put this in the KeyPress event of the textbox:

    Code:
         if (Strings.AscW(e.KeyChar) == 13) {
             WebBrowser.Navigate(txtURL.Text);
         }
     
  5. hampe-92

    hampe-92 Forum Addict

    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0
    Webbrowser help

    hmm... can u explain what the (Strings.AscW part means? and what is 13?
     
  6. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    Webbrowser help

    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.
     
  7. hampe-92

    hampe-92 Forum Addict

    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0
    Webbrowser help

    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
     
  8. exapto

    exapto #1 OSRS Magic Training Service
    $50 USD Donor New

    Joined:
    Oct 10, 2008
    Posts:
    645
    Referrals:
    0
    Sythe Gold:
    123
    Vouch Thread:
    Click Here
    Discord Unique ID:
    716746285151027321
    Discord Username:
    exapto#2360
    Homosex
    Webbrowser help

    Thats actually pretty good snippet you got there =)

    Man, I need to brush up on my C#......
     
  9. hampe-92

    hampe-92 Forum Addict

    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0
    Webbrowser help

    thx :)
    and do so... cause it's realy fun :p
     
  10. PinBuyer_

    PinBuyer_ Active Member
    Banned

    Joined:
    Oct 10, 2008
    Posts:
    140
    Referrals:
    0
    Sythe Gold:
    3
    Webbrowser help

    Heh that's what I was looking for, KeyCode.

    You can also do:

    e.KeyCode == 13
     
  11. hampe-92

    hampe-92 Forum Addict

    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0
    Webbrowser help

    yea i know, but then u should use KeyPress, right?
    but Enter makes more sence than 13...
     
  12. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    Webbrowser help

    Yes. The use of what is called "Magic numbers" is extremely bad practice.
     
  13. hampe-92

    hampe-92 Forum Addict

    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0
    Webbrowser help

    yeah.. but how do u even know which button is which number anyway??
     
  14. jokool

    jokool Guest

    Referrals:
    0
    Webbrowser help

    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?
     
  15. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    Webbrowser help

  16. hampe-92

    hampe-92 Forum Addict

    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0
    Webbrowser help

    ah thx :) althought this is a realy old thread ;)
    and @jokool: you better get a own thread if you need help... and what has that to do with C# anyway??
     
< Tic-Tac-Toe Help [JCreator Pro] | Which Compiler should I use. >


 
 
Adblock breaks this site