Hopefully someone here can help me along with this....

I have a multi-dimension array which would look something like this:

B N27 W38
F N10 E11
N S13 W18

etc etc

I now need to do something like the following with it:

For each "row" in the array
Do calculation on the number part of Column 2
IF N assign +ive sign to the answer
IF S assign -ive sign to the answer
Do calculation on the number part of column 3
IF E assign +ive sign to the answer
IF W assign -ive sign to the answer

Draw Point (Answer2, Answer1)
IF column 1 = B draw in red
IF column 1 = F draw in green
IF column 1 = N draw in blue

NEXT "row"

If anyone can give me some pointers as to how i go about this, that would be great. I've been trying to do this for days :-)

Private Type MyType
Field1 as string
Field2 as string
field3 as string
EndType

Private MyData(100) as MyType
Private MyDataCount as long

Private Sub DoCalculations()
Dim i as long
Dim Answer1 as long
Dim Answer2 as long

for i = 0 to MyDataCount - 1
IF (Left(MyData(i).Field2, 1) = "N") then
Answer1 = Val(mid(MyData(i).Field2, 2))
ElseIF (Left(MyData(i).Field2, 1) = "S") then
Answer1 = -Val(mid(MyData(i).Field2, 2))
end if
IF (Left(MyData(i).Field3, 1) = "E") then
Answer1 = Val(mid(MyData(i).Field3, 2))
ElseIF (Left(MyData(i).Field3, 1) = "W") then
Answer1 = -Val(mid(MyData(i).Field3, 2))
end if

DrawPoint Answer2, Answer1

IF (column 1 = B) then drawColour = vbred
IF (column 1 = F) then drawColour = vbgreen
IF (column 1 = N) then drawColour = vbBlue
next i
End Sub

' Good luck!

0

codeheavenAuthor Commented:

Thanks supunr!

Just one thing though... how do i populate this user defined type from my array? If the array name is something like strResults()?

Option Explicit

Private Type MyType

Field1 as string

Field2 as string

field3 as string

EndType

Private MyData(100) as MyType

Private MyDataCount as long

Private Sub DoCalculations()

Dim i as long

Dim Answer1 as long

Dim Answer2 as long

for i = 0 to MyDataCount - 1

IF (Left(MyData(i).Field2, 1) = "N") then

Answer1 = Val(mid(MyData(i).Field2, 2))

ElseIF (Left(MyData(i).Field2, 1) = "S") then

Answer1 = -Val(mid(MyData(i).Field2,

end if

IF (Left(MyData(i).Field3, 1) = "E") then

Answer1 = Val(mid(MyData(i).Field3, 2))

ElseIF (Left(MyData(i).Field3, 1) = "W") then

Answer1 = -Val(mid(MyData(i).Field3,

end if

DrawPoint Answer2, Answer1

IF (column 1 = B) then drawColour = vbred

IF (column 1 = F) then drawColour = vbgreen

IF (column 1 = N) then drawColour = vbBlue

next i

End Sub

' Good luck!