G
Guest
Hello,
Background information ….
I have a VS2005 C# Windows forms app which has several text fields, one
button control and one webbrowser control that I use to display an external
webpage and based on the input data provided by the user, I perform some
tasks on the webpage. The idea is to go automatically go through several web
pages based in data captured by the user until I reach to a desired webpage.
All this works fine,
The user fills the data on the windows form, then clicks on the form's
button and the process starts.
The click method of this button does something like like …
private void btnSendData_Click(object sender, EventArgs e)
{
Uri myUri = new Uri (http://www.externalwebsite/page1.htm);
this.myWebBrowser.Url = myUri;
this.stageSecuence = 1;
}
I use a variable named "stageSecuence" in the next method to perform some
automated tasks depending on the webpage that is being processed.
Then for the webbrowser control I have the following method:
private void myWebBrowser_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
switch (this.stageSecuence)
{
case 1:
// perform some tasks like invoking the submit on the web page
this.stageSecuence++;
case 2:
// perform some other tasks
this.stageSecuence++;
// and so on
}
Current situation,
Now, instead of executing this automation on the webpage based on the data
manually typed by the user; I want to call this process several times based
on some database information.
I wrote the following code to perfom a loop (hoping to call sereval times
the automation process)
for (int i = 0; i < this.numberOfTableRecords; i++)
{
// get record info
Uri myUri = new Uri (http://www.externalwebsite/page1.htm);
this.myWebBrowser.Url = myUri;
this.stageSecuence = 1;
}
By doing this I only get the myWebBrowser_DocumentCompleted method executed
only once for the last record of the loop; in fact this method is executed
once the loop has finished.
How can I get the DocumentCompleted method executed once for every record in
the loop ?
Can I call this method manually such as:
this.myWebBrowser_DocumentCompleted( … ) ??
Thanks in advance,
Cesar
Background information ….
I have a VS2005 C# Windows forms app which has several text fields, one
button control and one webbrowser control that I use to display an external
webpage and based on the input data provided by the user, I perform some
tasks on the webpage. The idea is to go automatically go through several web
pages based in data captured by the user until I reach to a desired webpage.
All this works fine,
The user fills the data on the windows form, then clicks on the form's
button and the process starts.
The click method of this button does something like like …
private void btnSendData_Click(object sender, EventArgs e)
{
Uri myUri = new Uri (http://www.externalwebsite/page1.htm);
this.myWebBrowser.Url = myUri;
this.stageSecuence = 1;
}
I use a variable named "stageSecuence" in the next method to perform some
automated tasks depending on the webpage that is being processed.
Then for the webbrowser control I have the following method:
private void myWebBrowser_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
switch (this.stageSecuence)
{
case 1:
// perform some tasks like invoking the submit on the web page
this.stageSecuence++;
case 2:
// perform some other tasks
this.stageSecuence++;
// and so on
}
Current situation,
Now, instead of executing this automation on the webpage based on the data
manually typed by the user; I want to call this process several times based
on some database information.
I wrote the following code to perfom a loop (hoping to call sereval times
the automation process)
for (int i = 0; i < this.numberOfTableRecords; i++)
{
// get record info
Uri myUri = new Uri (http://www.externalwebsite/page1.htm);
this.myWebBrowser.Url = myUri;
this.stageSecuence = 1;
}
By doing this I only get the myWebBrowser_DocumentCompleted method executed
only once for the last record of the loop; in fact this method is executed
once the loop has finished.
How can I get the DocumentCompleted method executed once for every record in
the loop ?
Can I call this method manually such as:
this.myWebBrowser_DocumentCompleted( … ) ??
Thanks in advance,
Cesar