here is the code that is keeping the previous webpage instead of the
new one that is being called (in other words, it isn't changing to the
new website that is in the string array below): [...]
Here are some links you may find helpful:
http://www.yoda.arachsys.com/csharp.../csharp/incomplete.htmlhttp://sscce.org/(some Java-centric stuff, but mostly applicable to any
programming questions)
I just want to somehow loop this until all of the "contact" pages that
are loaded and the emails are gathered successfully, but I can't get
to the second website that is in the array
strArrayWWWcargoShipNamesCleaned1[cc]. The first one works fine...I
just want all of them
to work the same way...Here is the code I have so far and any help or
insight is much appreciated:
mshtml.HTMLDocumentClass doc2 = (mshtml.HTMLDocumentClass)
this.axWebBrowser1.Document;
//MessageBox.Show(doc2.documentElement.innerHTML);
StringBuilder sb2 = new StringBuilder();
string str2 = "";
sb2.Append(doc2.documentElement.innerHTML);
str2 = sb2.ToString();
Regex exp2 = new Regex(@"(?<=href="")[^""]+contact
[^""]+", RegexOptions.IgnoreCase);
MatchCollection collection2 = exp2.Matches(str2);
if (collection2.Count > 0)
{
string testString1 = string.Empty;
foreach (Match match2 in collection2)
{
//do something here
GroupCollection groups = match2.Groups;
testString1 = string.Format("{1}", groups
["word"].Value, groups[0].Value, groups[1].Value);
}
object loc3 = strArrayWWWcargoShipNamesCleaned1
[cc] + testString1;
object null_obj_str3 = "";
System.Object null_obj3 = 0;
this.axWebBrowser1.Navigate2(ref loc3, ref
null_obj3, ref null_obj3, ref null_obj_str3, ref null_obj_str3);
Task++;
cc++;
//getEmailAgain_Load();
break;
}
else
{
//found no contact page, so do this...
Task = 3;
}
break;
case 4:
mshtml.HTMLDocumentClass doc3 =
(mshtml.HTMLDocumentClass)this.axWebBrowser1.Document;
//MessageBox.Show(doc3.documentElement.innerHTML);
StringBuilder sb3 = new StringBuilder();
//string str3 = "";
sb3.Append(doc3.documentElement.innerHTML);
str3 = sb3.ToString();
Regex exp3 = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w
+)*\.\w+([-.]\w+)*", RegexOptions.IgnoreCase);
MatchCollection collection3 = exp3.Matches(str3);
if (collection3.Count > 0)
{
//testString3[] = Array.Clear;
int thisInt = 0;
foreach (Match match3 in collection3)
{
//do something here
GroupCollection groups = match3.Groups;
testString3[thisInt] = string.Format
("{1}", groups["word"].Value, groups[0].Value, groups[1].Value);
thisInt++;
//write out emails here to db or text...
}
//save the email and
//continue on to the next companies website...
//Task = 3;
//Close();
//Task++;
//getNextCompanysContactHTML();
break;
}
else
{
//found no emails, so do this...
//Task = 3;
}
break;
Thanks,
Trint