I'm new to programming, I'm trying to use the webbrowser1
to increase the hit counter on a webpage, I can do this manually by clicking on the button to increase the hit counter, what I really wanted to do is make a for(i=0; i < 10 ; i++)
statement to refresh the page 10 times, but then I use the statement like this it only increases the page by one, please see the code below, thanks in advance.
url: http://www.comptechdoc.org/independent/web/cgi/javamanual/javaihit.html
namespace click
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i;
for (i = 0; i < 10; i++)
{
webBrowser1.Refresh();
Application.DoEvents();
}
}
}
}
edit: thank you guys, for all your help and fast replys.
I've tryed the code from here: C# how to wait for a webpage to finish loading before continuing and it seems to work well.
private void button1_Click(object sender, EventArgs e)
{
int i;
for (i = 0; i < 10; i++)
{
webBrowser1.Navigate(url);
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
}
}