webBrowser IndexOf, strange value.

  • Thread starter Thread starter Boki
  • Start date Start date
B

Boki

Hi All,

Q1: the page total char is 2336 ( count by MS Word ), but IndexOf
return 16xxx, it is larger than total lenght, interesting thing is
when I use substring to get the string I want, it still works.

Q2. Due 'at' return very large value, how to deal with overflow
issue ....


/* CODE BEGIN */
int at =0;

private void webBrowser1_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{

while ( at !=-1)
{
at = webBrowser1.DocumentText.IndexOf("something somewhere",start);
start=at+1;
}
}
/*CODE END */

Best regards,
Boki.
 
Q1: the page total char is 2336 ( count by MS Word ), but IndexOf
return 16xxx, it is larger than total lenght, interesting thing is
when I use substring to get the string I want, it still works.

Not sure what the question is here. But since you're dealing with a
WebBrowser control, I guess the string contains HTML tags that you
don't see when viewing the document in Word.

Q2. Due 'at' return very large value, how to deal with overflow
issue ....

You'll reach the size limit of a string object before int would
overflow, so don't worry about that.


Mattias
 
Not sure what the question is here. But since you're dealing with a
WebBrowser control, I guess the string contains HTML tags that you
don't see when viewing the document in Word.


You'll reach the size limit of a string object before int would
overflow, so don't worry about that.

Mattias

Thanks!

Boki.
 
Back
Top