how do check if the item is outside of the arrray...C# equivalent of this code

     
I am using Dundas Charts and depending on what is returned from the database it checks to see if a data point exists.

so what is the C# equivalent of the following vb code.. in C# I need to test if Chart1.Series(0).Points(6) exists or not.  If it does continue, if not ..ignore

right now I have this

if(!Chart1.Series[0].Points[6].Empty)
 {
                            Chart1.Series[0].Points[6]["Exploded"] = "True";
 }

but I am getting

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

I know it is out of range but I need to check for it because sometimes it is not out of range.

this code works in VB.
   If Not Chart1.Series(0).Points(6).Empty Then
                            Chart1.Series(0).Points(6)("Exploded") = "True"
 End If

any help is greatly appreciated.
lino_evolutionAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
Try:
if(Chart1.Series[0].Points.Length > 6 && !Chart1.Series[0].Points[6].Empty)
{
    Chart1.Series[0].Points[6]["Exploded"] = "True";
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
saffadrazCommented:
i have never used this control however i would check the above comment and if that does not work for you then try looking for a count

Chart1.Series[0].Count
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.