Results 1 to 1 of 1

Thread: Moving Backward through text

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    Question Moving Backward through text

    Hi all, I have a prog that hashes a text file and is able to skip though large portions of it in the forward direction.

    I need to be able to do the same thing in the reverse direction. This is the forward one -
    VB Code:
    1. Dim wc As String, I%, z%
    2.     ' *****************************
    3.     Form1.MousePointer = 11
    4.     If last_rcd = 1 Then
    5.         CleanFields (1)
    6.         rcdcnt1% = totrcds%
    7.         'Form8.ProgressBar1.Value = 100
    8.         Form1.NEXTBUT.Visible = False
    9.         Form1.OptBut.Visible = False
    10.         CLOSEFILE_CLICK
    11.     End If
    12.     ' *****************************
    13.     Do
    14.         If last_rcd = 0 Then 'filenum > 0 Then
    15.             ShowRecord '(last_rcd)
    16.             wc = Nsnap.SF1
    17.             I% = CkKeyWC(wc)
    18.             If ((I% = 0) And (Form4.Check1.Value = 1)) Or ((NoSupport$ = "yes") And (Form4.Check3.Value = 0)) Then
    19.                 nextjcn% = JCNcnt1% + 1
    20.                 SkipIt$ = "Y"
    21.             ' **************
    22.             ElseIf nextjcn% > JCNcnt1% Then
    23.                 SkipIt$ = "Y" ' Auto skip forward
    24.             ElseIf nextjcn% < JCNcnt1% Then
    25.                 Close (Filenum)
    26.                 CleanFields (1)
    27.                 JCNcnt1% = 0
    28.                 rcdcnt1% = 0
    29.                 skipcnt2% = 0
    30.                 'Form8.ProgressBar1.Value = 0
    31.                 Form8.Label8.Caption = " "
    32.                 'Form8.Label17.Caption = "0%"
    33.                 Open Filename For Input As Filenum
    34.                 ReadCard (0)  ' Lable card
    35.                 ReadCard (1)  ' Read 1st card
    36.                 jcn = Left(textdata, 13)
    37.                 'form1.Refresh
    38.                 OLDJCN = jcn
    39.                 SkipIt$ = "Y" '
    40.             Else
    41.                 SkipIt$ = "N" '
    42.                 nextjcn% = JCNcnt1% + 1
    43.             End If
    44.             'z% = (rcdcnt1% / totrcds%) * 100
    45.             'Form8.ProgressBar1.Value = z%
    46.         End If
    47.     Loop Until SkipIt$ = "N" Or last_rcd = 1 'filenum = 0
    48.     ' ************************
    49.     NoSupport$ = "no"
    50.     flagopt% = 0
    51.     Get_Show ' Move fields to display window
    52.     Form1.MousePointer = 0
    I thought I could just modify it and this is what I get that kinda works -
    VB Code:
    1. Dim wc As String, I%, z%
    2.     ' *****************************
    3.     Form1.MousePointer = 11
    4.     If last_rcd = 1 Then
    5.         CleanFields (1)
    6.         rcdcnt1% = totrcds%
    7.         Form1.NEXTBUT.Visible = False
    8.         Form1.OptBut.Visible = False
    9.         CLOSEFILE_CLICK
    10.     End If
    11.     ' *****************************
    12.     Do
    13.    
    14.         If last_rcd = 0 Then 'filenum > 0 Then
    15.             ShowRecordReverse '(last_rcd)
    16.             wc = Nsnap.SF1
    17.             I% = CkKeyWC(wc)
    18.             If ((I% = 0)) And (Form4.Check1.Value = 1) Or ((NoSupport$ = "yes") And (Form4.Check3.Value = 0)) Then '
    19.                 rcdcnt1% = rcdcnt1% - 1
    20.                 SkipIt$ = "Y"
    21.             If ((I% <> 0)) And (Form4.Check1.Value <> 1) Or ((NoSupport$ = "NO") And (Form4.Check3.Value = 0)) Then '
    22.                 Close (Filenum)
    23.                 CleanFields (1)
    24.                 Open Filename For Input As Filenum
    25.                 ReadCard (0)  ' Lable card
    26.                 ReadCard (1)  ' Read 1st card
    27.                 ShowRecordReverse
    28.             End If
    29.             End If
    30.         End If
    31.     Loop Until SkipIt$ = "N" Or last_rcd = 1 'filenum = 0
    32.     ' ************************
    33.     NoSupport$ = "no"
    34.     flagopt% = 0
    35.     Get_Show ' Move fields to display window
    36.     Form1.MousePointer = 0
    It will read the record number in reverse, but not the text associated with the record.

    Any Ideas?

    John




    Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack
    Last edited by Hack; Dec 6th, 2005 at 01:00 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width