Visual Basic 6 Code Failure

  • From: "Steven Hicks" <Steven.Hicks@xxxxxxxxxxxxxxx>
  • To: <Programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 18 Sep 2007 11:30:47 +0100

Hello friends,

I wonder if anyone with VB6 experience can take a look at my code below and see 
if they can figure out at the bottom of the arraysort procedure why it doesn't 
actually call the public function at the top of the code?

Many thanks in anticipation,

Steve.

Code:


Option Explicit

Dim Temp As Variant, X As Integer

'Code:

Public Function SrtArray(ByRef TheArray As Variant)
Sorted = False
Do While Not Sorted
    Sorted = True
For X = 0 To UBound(arraysort) - 1
    If arraysort(X) > arraysort(X + 1) Then
        Temp = arraysort(X + 1)
        arraysort(X + 1) = arraysort(X)
        arraysort(X) = Temp
        Sorted = False
    End If
Next X
Loop
End Function


Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdsort_Click()
Dim infostring As String, filename As String
Dim X As Integer, i As Integer, filesize As Long
filename = "WINTELE.DAT"
i = 1
X = FreeFile
Open filename For Random As #X Len = 160
filesize = LOF(X): filesize = filesize / 160
Dim SortArray(100000)
Do While Not EOF(X)
Get #X, i, infostring
SortArray(i) = infostring
i = i + 1
Loop
MsgBox (filesize)
MsgBox (SortArray(filesize - 20))

Close
'This Code Developed by Chris Vann
'Just copy it into a separate module, then call it from
'anywhere in your program as SortArray ArrayGoesHere
SrtArray
End Sub


Private Sub Form_Load()

End Sub




---------------------------------------------------------------------
-
-
-
-
-
-
The information in this e-mail and any attachments is confidential
and
is
intended for the attention and use of the named addressee(s).  It
must
not
be disclosed to any other person  without our authority.  If you are
not
the intended recipient, or a person responsible for delivering it to
the
intended recipient or are aware that this e-mail has been sent to
you
in
error, you are not authorised to and must not disclose, copy,
distribute,
or retain this message or any part of it.

We sweep all outgoing messages for the presence of computer viruses.
However, we cannot accept any responsibility for any loss or damage
to
your systems due to viruses or malicious code not detected.

The statements and opinions expressed in this message are those of
the
author and do not necessarily reflect those of the organisations
within
the Cornwall & Isles of Scilly Health Community.

This email may be disclosed under the Freedom of Information  Act
2000
or
the Environmental Information Regulations 2004.
---------------------------------------------------------------------
-
-
-
-
-
-
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: