G
Guest
Hello all.
I am making a small silly little basic one page web form while learning C#
(Using VS 2005 Express). I am stuck on how to link a button I have created,
to actually send the user to a specified URL when clicked, into the attached
WebBrowser form.
I thought
WebBrowser.Navigate ("http://www.google.com");
should do the trick, under each button, but they still do nothing. What
n00bish thing am I missing here?
Attached is my code:
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
#endregion
namespace New
{
partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void btnPrint_ContextClick(object sender, EventArgs e)
{
}
private void progressBar1_Click(object sender, EventArgs e)
{
}
private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
}
private void frmMain_Load(object sender, EventArgs e)
{
}
private void btnPrint_ContextClick_1(object sender, EventArgs e)
{
webBrowser.Print();
}
private void btnXMFINFO_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate ("http://www.google.com");
}
private void btnEXEC_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnENGR_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnMETAPURCH_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnACCO_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnHUMA_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnSHIP_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnPLAS_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnSPEC_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
}
}
Notice I am using about 9 buttons I am wanting to attach to a different URL
(buttons named btnINFOMARK, etc.). I want these buttons to hold a URL, and
when clicked, open the corresponding URL in the WebBrowser component that is
on the same form.
Please help! =)
Thanks,
Chris
I am making a small silly little basic one page web form while learning C#
(Using VS 2005 Express). I am stuck on how to link a button I have created,
to actually send the user to a specified URL when clicked, into the attached
WebBrowser form.
I thought
WebBrowser.Navigate ("http://www.google.com");
should do the trick, under each button, but they still do nothing. What
n00bish thing am I missing here?
Attached is my code:
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
#endregion
namespace New
{
partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void btnPrint_ContextClick(object sender, EventArgs e)
{
}
private void progressBar1_Click(object sender, EventArgs e)
{
}
private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
}
private void frmMain_Load(object sender, EventArgs e)
{
}
private void btnPrint_ContextClick_1(object sender, EventArgs e)
{
webBrowser.Print();
}
private void btnXMFINFO_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate ("http://www.google.com");
}
private void btnEXEC_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnENGR_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnMETAPURCH_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnACCO_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnHUMA_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnSHIP_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnPLAS_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
private void btnSPEC_ContextClick(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.google.com");
}
}
}
Notice I am using about 9 buttons I am wanting to attach to a different URL
(buttons named btnINFOMARK, etc.). I want these buttons to hold a URL, and
when clicked, open the corresponding URL in the WebBrowser component that is
on the same form.
Please help! =)
Thanks,
Chris