Missing some data problem (Visual Basic 6.0)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • beginner76
    New Member
    • Jul 2013
    • 1

    Missing some data problem (Visual Basic 6.0)

    Hello everyone,

    I am trying to improve a program written in Visual Basic 6.0.

    The program will load data from a BL file to the database, then I found there is a bug here. The program always missing some data, especially the last data of the file.

    I read the program code and guess maybe the mouse pointer effects the program,so I tried to modify the number but the error is still exists.

    I use many methods to fix the bug but the program still miss the data.

    Here is the original code of the program:

    Code:
    Private Sub startprocess()
    Dim strTemp As String
    strTemp = Dir(dir1.Text)
    Me.MousePointer = 11
    DoEvents
    Do Until strTemp = ""
        Select Case UCase(Left(strTemp, 2))	
        Case "BLfile"
              If Len(strTemp) = 8 Then
                 Me.MousePointer = 11                
                Call LoadBLFile(dir1.Text & strTemp, strTemp)
                 Me.MousePointer = 0
               End If
         End Select
            strTemp = Dir
    Loop
     Me.Height = 2000
    DoEvents
    Me.MousePointer = 0
    DoEvents
    End Sub
    Does anyone has ideas or advice about how to fix the error?

    Thank you.

    Yours faithfully,

    beginner76
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    If it's the loading of the file that is missing data, then we need to see the code that loads the file. Not the code that calls the function to load the file.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      The Case test on line 8 can never be True, because you're checking a two-character (or shorter) string and comparing it with an eight-character value.

      Allow me to break it down...
      Code:
      UCase(Left(strTemp, 2))
      This takes strTemp, extracts the first 2 characters, converts them to upper case, then uses the result. So for example if strTemp contained "blfile" the result of this would be the value "BL".

      Setting the value of Me.MousePointer just changes the look of the mouse pointer when it's over the form. It does not affect the operation of the code. I believe 11 changes it to an hourglass, to show the user that the program is busy.

      Comment

      Working...