Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

text files

Posted on 2003-03-23
2
Medium Priority
?
137 Views
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.Show
        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
                Next    
         frmVeiwInfo.Text1.Text = frmVeiwInfo.Text1.Text + buf
         Wend
         
        Close #1
     
            Else
                Prompt = "C:\PilotInfo\quotes.txt does not exist"
                MsgBox (Prompt), , "Error"
     End If
Thanks in advance
0
Comment
Question by:mboscorellio
2 Comments
 
LVL 2

Accepted Solution

by:
JoaTex earned 200 total points
ID: 8190191
Hi

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.Show
       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 = ""
                 Else
                  Exit Sub
               End If
            End If
        Wend
       
       Close #1
     
           Else
               prompt = "C:\PilotInfo\quotes.txt does not exist"
               MsgBox (prompt), , "Error"
    End If
    End Sub

Good Luck
Jo
0
 

Author Comment

by:mboscorellio
ID: 8191574
That worked great Thx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

569 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