Web Browser

Hi, I have a web program that working but the addressBar and the form title bar do not updating. Thanks for any help.

Answer this question

Web Browser

  • Stephan M

    Zulbaric wrote:
    Can i just ask one question How would you alter the code to fit a tab system

    You create a factory class or a method on your form that can create TabPages, so you can add them on runtime. So it creates a TabPage with an WebBrowser control on top of it. But, a better way is to create a your own TabPage by inhire the TabPage class.



  • tetsu-

    I am not getting any exception but it just does not work. Like when I am starting the browser with certain web address any other except the home address it ignoring the address in the address bar and going to msn.com. web title does not updated either.
  • alungwyther

    Can you post the relevant code, how do you update the addressbar en form title

    This should do the trick:


    private void webBrowser1_Navigated( object sender, WebBrowserNavigatedEventArgs e )
    {
    txtAddressBar.Text = e.Url;
    }

    private void webBrowser1_ProgressChanged( object sender, WebBrowserProgressChangedEventArgs e )
    {
    this.Text = e.CurrentProgress;
    }




  • Jonno232

    I keep on getting errors from the compiler. I mean this code my work on any other VS Version but it might not work good on the Express version.

    This is on of the errors

    Error 1 Cannot implicitly convert type 'System.Uri' to 'string' C:\Documents and Settings\jbattat\My Documents\Visual Studio 2005\Projects\Web\Web\webForm.cs 79 31 Web

    jbattat


  • MarkDavies

    Can i just ask one question How would you alter the code to fit a tab system

  • Amit Basu

    Are the event raised Does the code in the event handler method get executed and what are the argument values


  • AudiRS6

    What does not work Do you get an exception

    As far as i know the KeyPress event don't get fired when return is pressed. You can us the KeyDown event instead.


  • PascalLeBeta

    I wrote it out of the head, sorry my bad:


    private void webBrowser1_Navigated( object sender, WebBrowserNavigatedEventArgs e )
    {
    txtAddressBar.Text = e.Url.ToString();
    }

    private void webBrowser1_ProgressChanged( object sender, WebBrowserProgressChangedEventArgs e )
    {
    this.Text = e.CurrentProgress;
    }




  • k.praful

    I got the same when I was first programming my web browser. You need to change the KeyPress commands to the KeyDown event instead.
  • Ambrish Mishra - MSFT

    I have got an error stating that cannot convert to string. but this what supposed to work but it does not.

    private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)

    {

    progressBar1.Value = (int)(((double)e.CurrentProgress / e.MaximumProgress) * 100);

    }

    private void addressBar_KeyPress(object sender, KeyPressEventArgs e)

    {

    if (e.KeyChar == (char)Keys.Return)

    {

    webBrowser1.Navigate(addressBar.Text);

    e.Handled = true;

    }

    }

    // Updates the URL in TextBoxAddress upon navigation.

    private void webBrowser1_Navigated(object sender,

    WebBrowserNavigatedEventArgs e)

    {

    addressBar.Text = webBrowser1.Url.ToString();

    Form.ActiveForm.Text = webBrowser1.Url.ToString();

    }


  • Web Browser