際際滷

際際滷Share a Scribd company logo
Vs c# lecture12
Vs c# lecture12
Enable the user to browse the web pages inside his form.
In this project
 Drag down a WebBrowser
 Drag down tool strips
 6 button
 Back
 Forward
 Go
 Refresh
 Search
 home
 1 textbox (for entering URL)
private void toolStripButton1_Click(object sender, EventArgs e)
{
string myurl = "http://" + toolStripTextBox1.Text;
webBrowser1.Navigate(myurl);
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
webBrowser1.GoForward();
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
webBrowser1.Refresh();
}
private void toolStripButton5_Click(object sender, EventArgs e)
{
webBrowser1.GoHome();
}
private void toolStripButton6_Click(object sender, EventArgs e)
{
webBrowser1.GoSearch();
}
private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
if (Convert.ToInt32(e.CurrentProgress) > 0)
{
toolStripProgressBar1.Maximum = Convert.ToInt32(e.MaximumProgress);
toolStripProgressBar1.Value = Convert.ToInt32(e.CurrentProgress);
}
}
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode==Keys.Enter)
{
string myurl = "http://" + toolStripTextBox1.Text;
webBrowser1.Navigate(myurl);
}
}
Vs c# lecture12

More Related Content

Vs c# lecture12

  • 3. Enable the user to browse the web pages inside his form.
  • 4. In this project Drag down a WebBrowser Drag down tool strips 6 button Back Forward Go Refresh Search home 1 textbox (for entering URL)
  • 5. private void toolStripButton1_Click(object sender, EventArgs e) { string myurl = "http://" + toolStripTextBox1.Text; webBrowser1.Navigate(myurl); } private void toolStripButton3_Click(object sender, EventArgs e) { webBrowser1.GoBack(); } private void toolStripButton2_Click(object sender, EventArgs e) { webBrowser1.GoForward(); } private void toolStripButton4_Click(object sender, EventArgs e) { webBrowser1.Refresh(); }
  • 6. private void toolStripButton5_Click(object sender, EventArgs e) { webBrowser1.GoHome(); } private void toolStripButton6_Click(object sender, EventArgs e) { webBrowser1.GoSearch(); } private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e) { if (Convert.ToInt32(e.CurrentProgress) > 0) { toolStripProgressBar1.Maximum = Convert.ToInt32(e.MaximumProgress); toolStripProgressBar1.Value = Convert.ToInt32(e.CurrentProgress); } }
  • 7. private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e) { if(e.KeyCode==Keys.Enter) { string myurl = "http://" + toolStripTextBox1.Text; webBrowser1.Navigate(myurl); } }