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.
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.
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
Web Browser
Stephan M
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-
alungwyther
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
Amit Basu
AudiRS6
As far as i know the KeyPress event don't get fired when return is pressed. You can us the KeyDown event instead.
PascalLeBeta
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
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();}