Ok so this is some code im writing to help me out on a game, anyway this stumped me...
ok so this calls my method:
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (webBrowser1.Document.Url.OriginalString.Contains(@"page=logs"))
{
AttatchProcess Test = new AttatchProcess();
Test.LogCleanser(webBrowser1);
}
}
And heres the method:
public void LogCleanser(WebBrowser TargetBrowser)
{
if (TargetBrowser.Url.OriginalString.Contains(@"page=logs"))
{
Regex FindIP = new Regex(IPExpression);
HtmlElement LogArea = TargetBrowser.Document.GetElementsByTagName("textarea")[0];
string log = LogArea.InnerHtml.ToString();
foreach (Match ipfound in FindIP.Matches(log))
{
if (ipfound.Value == MyIP)
{
log.Replace(ipfound.Value, "");
}
}
}
So as soon as the called method hits a line of code assigning an objects value to something in the documents HTML it ends the method, in this case the line:
HtmlElement LogArea = TargetBrowser.Document.GetElementsByTagName("textarea")[0];
is hit and kills the method, any help and ideas much appriciated!