solid7
Mechanical
- Jun 7, 2005
- 1,403
In the following code, I have annotated what works, and what doesn't. The code worked fine, until I put the handling in, to catch the cases where there are no annotations.
Code:
Annotations oAnnotations = (Annotations)oAnnotationSet.Annotations;
MessageBox.Show("annotation count = " + oAnnotations.Count); [b]<== Does NOT work here - throws error[/b]
if (oAnnotations.Count != 0)
{
for (int i = 1; i <= oAnnotations.Count; i++) [b]<== Works here - no error, expected result[/b]
{
Annotation oAnnotation = (Annotation)oAnnotations.Item2(i);
oAnnotationsList.Add(oAnnotation);
}
}