Results 1 to 4 of 4

Thread: Text File Input Help *please help me*

  1. #1

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Exclamation Text File Input Help *please help me*

    I am trying to make a basic math program for an assignment. At the end of the sums it saves the details into a into a text file. The next form shows a summary page that reads the data. However it will not read any "/" or ",".
    The text file data is as follows:

    7/08/2007,0,30,3

    What i want it to do, is that it will read all the data UNTIL if finds the "," the data is then to go into the textbox, then continue reading after the "," until it finds the next "," and do this until the end of the file

    I no this can be done, but its beyond what i no, and i need help. You help will be greatly appreciated because it is due soon.
    Thanks
    Fen

    REMEMBER TO RATE

  2. #2
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Text File Input Help *please help me*

    Post what you have and I'm sure people will guide you (rather than do it for you, if you no what I mean)

  3. #3

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Re: Text File Input Help *please help me*

    ok its:

    Code:
    Dim textboxnumber As Integer
    Do Until a = 3
    Input #2, sText
        
        If sText = "," Then
        textboxnumber = textboxnumber + 1
        End If
    
    Text1(textboxnumber).Text = Text1(textboxnumber).Text & sText
    a = a + 1
    Loop

    REMEMBER TO RATE

  4. #4
    Addicted Member
    Join Date
    Feb 2007
    Posts
    187

    Re: Text File Input Help *please help me*

    Quote Originally Posted by feneck
    ok its:

    Code:
    Dim textboxnumber As Integer
    Do Until a = 3
    Input #2, sText
        
        If sText = "," Then
        textboxnumber = textboxnumber + 1
        End If
    
    Text1(textboxnumber).Text = Text1(textboxnumber).Text & sText
    a = a + 1
    Loop
    mayb you can try use the Split function.

    i help you do some modification, try to have a look

    Code:
    Dim FileNumber As Integer, i As Integer
    Dim TempStr
    Dim sText As String
    
           FileNumber = FreeFile
    
           Do While Not EOF(FileNumber)
                  Line Input #FileNumber, sText
           Loop
    
           Close #FileNumber
    
           TempStr = Split(sText, ",")
        
           For i = LBound(TempStr) To UBound(TempStr)
                  Text1(i).Text = Text1(i).Text & TempStr(i)
           Next

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