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

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.
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
N

Nicholas Paldino [.NET/C# MVP]

Oh, yeah, and using the Length property on the array wouldn't hurt
either.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top