text files

Posted on 2003-03-23
Medium Priority
Last Modified: 2010-05-01
In the following code I need to: if line 10,21,32... = n then take the 9 lines above and the 10 line and put them in a buffer and if the 10,21,32... lines  are not n move on without storing the info in the buffer here is the code I have:

if Dir$("C:\PilotInfo\boards.txt") <> "" Then
        frmVeiwInfo.Caption = "not back"
        Wrap$ = Chr$(13) & Chr$(10)
        Open "C:\PilotInfo\boards.txt" For Input As #1
        While Not EOF(1)
            Line Input #1, buf
            linenum = linenum + 1
            For i = 10 To linenum Step 11
                If buf = "n" Or buf = "N" Then
                End If
         frmVeiwInfo.Text1.Text = frmVeiwInfo.Text1.Text + buf
        Close #1
                Prompt = "C:\PilotInfo\quotes.txt does not exist"
                MsgBox (Prompt), , "Error"
     End If
Thanks in advance
Question by:mboscorellio
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

JoaTex earned 200 total points
ID: 8190191

Here is Your code to do That.

Option Explicit
Dim LineNum
Dim MemoLine
Dim Wrap$
Dim Buf
Dim prompt
Private Sub Form_Click()
LineNum = 0
MemoLine = 10
frmVeiwInfo.Text1.Text = ""
If Dir$("C:\PilotInfo\boards.txt") <> "" Then
       frmVeiwInfo.Caption = "not back"
       Wrap$ = Chr$(13) & Chr$(10)
       Open "C:\PilotInfo\boards.txt" For Input As #1
      While Not EOF(1)
           Line Input #1, Buf
           frmVeiwInfo.Text1.Text = frmVeiwInfo.Text1.Text + Buf & Wrap$
           LineNum = LineNum + 1
           If LineNum = MemoLine Then
               MemoLine = MemoLine + 11
               If UCase(Buf) <> UCase("n") Then
                   frmVeiwInfo.Text1.Text = ""
                  Exit Sub
               End If
            End If
       Close #1
               prompt = "C:\PilotInfo\quotes.txt does not exist"
               MsgBox (prompt), , "Error"
    End If
    End Sub

Good Luck

Author Comment

ID: 8191574
That worked great Thx

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month13 days, 3 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question