Define screwy, What exactly is happening with your arrays. I can't test whats happening without any data. In other words need more information.

Good Luck, Jimmy

Hello,

I have made a Hockey Pool program that stores people and there picks and their picks points. The program also needs to sort the people in order of their respected points. Then I print out the peoples names in that order and what their total points are. Now here is the problem, I can't get my sorting routine to work once compiled. It works no problem when I am in working on it in VB, but once compiled it does some really screwy things. Any advice, comments, suggestions would be greatly appreciated Here is the code, I hope you can understand it and it isn't too messy:

Sub Sort()

Dim numbers(0 To 100) As Integer

Dim x As Integer, y As Integer, lowPos As Integer, T As Integer, Z As Integer, DInt3 As Integer, DInt4 As Integer

Dim DInt1 As Integer, DInt2 As Integer

For T = 0 To UserNum 'Go through all the poeple in the pool

numbers(T) = UserData(T).PTotal 'Add everyones total points to array numbers

NumArray(T) = T 'Keep track of the persons number in NumArray

Next T

'This is my actual sorting routine...it is basically a copy of QuickBasics SWAP??? command

For x = 0 To UserNum - 1

Let lowPos = x

For y = x + 1 To UserNum

If numbers(y) < numbers(lowPos) Then

Let lowPos = y

End If

Next y

DInt1 = numbers(x)

DInt2 = numbers(lowPos)

DInt3 = NumArray(x)

DInt4 = NumArray(lowPos)

numbers(x) = DInt2

numbers(lowPos) = DInt1

NumArray(x) = DInt4

NumArray(lowPos) = DInt3

Next x

'this is just a temp file to see where the error is

Open "print.tmp" For Output As #1

For Z = 1 To UserNum

SortArray(Z) = numbers(Z)

Print #1, SortArray(Z)

Print #1, NumArray(Z)

Next Z

Close #1

End Sub

Thanks a bunch in advance (I have been working on this prog. for over 8 months now and I can't seem to solve this problem)

BJ