Link to home
Start Free TrialLog in
Avatar of lino_evolution
lino_evolutionFlag for Afghanistan

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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