Click here to Skip to main content
16,012,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following code. When Browser loads first time, the function Function() is loaded and It finds "variable", but when the browser loads second time, funtion() is loaded but it doesnt find "variable" but I have checked the html and the variable exists. Anyone knows why is that?

C#
  void Browser_DocumentCompleted(object sender, EventArgs e)
        {
Function();
}

Function()
{
            string document= Browser.Document.Body.InnerHtml;
            
            string regex1 = @"(?<=label:</td><td></td><td>)\d{2,3}";
            
            int variable= 0;
            double variable1= 0;
           
            foreach (Match zx in Regex.Matches(document, regex1))
            {

                variable= zx.Value;
               
                MessageBox.Show(variable);

            }
}
Posted
Comments
Richard MacCutchan 25-Jul-13 4:05am    
The obvious answer is that your regex does not catch every instance.
Soloveikok 25-Jul-13 4:14am    
No regex works fine, I checked that by making a button, when function() fails to find string, i push a button and it finds the string, I think problem is with webbrowser document compleated event, but I havent figured out where it is

show us your client scirpts pls !
 
Share this answer
 
Comments
Soloveikok 25-Jul-13 4:47am    
I`m sorry, i`m new to programming, what do you mean by client scripts?
page --> right-click -->the source code
 
Share this answer
 
Comments
Soloveikok 25-Jul-13 5:27am    
the page is confidential, I cant post any code here. But the source code is ok, the regex exists at all time
Chui PuiKwan 25-Jul-13 6:45am    
sorry.I got out and cook now.
I think you maybe have't got the html element,so you can't get its value or set his value.
If you can show me your aspx code ,I can help you debug it.
Chui PuiKwan 25-Jul-13 6:47am    
additional,who does call the Browser_DocumentCompleted method?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900