http://support.microsoft.com/kb/309158/ ... BUG?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If GetUpperBound(n) returns a zero based dimension, should this line

ArraySize = MyData.GetUpperBound(0);

within the Button2_Click handler in fact be

ArraySize = 1 + MyData.GetUpperBound(0);

The full article is at http://support.microsoft.com/kb/309158/ and the
particular line of code in under step 7.

Thanks for confirming this or otherwise.
 
Yep, that looks like a bug. Also, the whole:

int ArraySize = new int();
ArraySize = MyData.GetUpperBound(0);

Is superfluous. I mean, do we really need the "new int()"?

I would submit feedback, making sure to rank the accuracy of the article
as low (1) and tell them why.
 
Oh, yeah, and using the Length property on the array wouldn't hurt
either.
 
Thanks Nicholas.

I have submited feedback as you suggested.

This article is quite poor in another respect, namely, if the file is
constrained to be unique in the table, the code just fails! I have now coded
round this.
 
Back
Top