Array of Points

yourfriendwayne

New Member
Hi,<BR><BR>I'm trying to dynamically build an array of Point objects and can't seem to get the correct syntax down (using VB). I've tried the following:<BR><BR>Dim intLoop as Integer<BR>Dim CurvePoints As Point() ' 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't seem to get it right. Thanks...PeterI don't know my VB.Net syntax very well..but wouldn'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>KarlThanks Karl! I'll give it a try...try changing the line<BR><BR>Dim CurvePoints As Point()<BR>to<BR><BR>Dim CurvePoints() As PointThanks! 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
 
Back
Top