Array of Points

1. Junior Member
Join Date
Dec 1969
Posts
15

## Array of Points

Hi,<BR><BR>I&#039;m trying to dynamically build an array of Point objects and can&#039;t seem to get the correct syntax down (using VB). I&#039;ve tried the following:<BR><BR>Dim intLoop as Integer<BR>Dim CurvePoints As Point() &#039; the array of Points<BR>For Each row In myTable.Rows<BR> CurvePoints.SetValue(New Point(row.Item("Percent"), row.Item("Amount")), intLoop)<BR> intLoop = intLoop + 1<BR> Next<BR><BR>objGraphics.DrawCurve(BlackPen, CurvePoints)<BR><BR>Any help would be much appreciated...can&#039;t seem to get it right. Thanks...Peter

2. Member
Join Date
Dec 1969
Posts
34

## RE: Array of Points

I don&#039;t know my VB.Net syntax very well..but wouldn&#039;t you need to index something like...<BR><BR>i = 0<BR>for each row in myTable.Rows<BR> CurvePoints(i).SetValue(....)<BR> i = i + 1<BR> intLoop = intLoop + 1<BR>next<BR><BR><BR>or, if the object itself contains an array...well your code is pretty far off...<BR><BR>Karl

3. Junior Member
Join Date
Dec 1969
Posts
15

## RE: Array of Points

Thanks Karl! I&#039;ll give it a try...

4. edc
Junior Member
Join Date
Dec 1969
Posts
6

## RE: Array of Points

try changing the line<BR><BR>Dim CurvePoints As Point()<BR>to<BR><BR>Dim CurvePoints() As Point

5. Junior Member
Join Date
Dec 1969
Posts
15

## RE: Array of Points

Thanks! I changed the code to the following and it worked:<BR><BR>Dim CurvePoints(100) As Point<BR>CurvePoints(0).X = 0<BR>CurvePoints(0).Y = 0

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•