Results 1 to 6 of 6

Thread: [RESOLVED] Write\ Read data to txt file as array

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    131

    Resolved [RESOLVED] Write\ Read data to txt file as array

    Hi all
    I need to write and read data to txt file . i have a 8 textbox as array index . i could write data in file but i can load data to textbox array so that each data show in own textbox. for example :afte loading data txt(0).text=txt0.all data loads in txt(0) but i want to load each data as separate textbox.
    code for wite :
    Code:
    Dim sFileText As String
     Dim iFileNo As Integer
     Dim iCount As Integer
     
     Dim sFileTextt As String
     Dim iFileNoo As Integer
     Dim iCountt As Integer
    Private Sub Command1_Click()
      
        
        iFileNo = FreeFile
            
        'open the file for reading
        Open App.Path & "\Roster1.txt" For Output As #iFileNo
        
        'read the file until we reach the end
        Do While Not iCount = 4 '30
            sFileText = Txt(iCount)
            Write #iFileNo, sFileText
            iCount = iCount + 1
        Loop
        
            Do While Not iCountt = 4 '30
            sFileTextt = Tx(iCountt)
            Write #iFileNo, sFileTextt
            iCountt = iCountt + 1
        Loop
        
        Close #iFileNo
        
        MsgBox "Written data to file."
    
    End Sub
    code for read :
    Code:
    Private Sub Command3_Click()
    Dim dText As String, dNextLine As String, lLineCount As Long
    lLineCount = 1
            Open App.Path & "\Roster1.txt" For Input As #1
            Do While Not EOF(1)
                Line Input #1, dNextLine
                dNextLine = Replace(dNextLine, Chr$(34), "")
              
                dText = dText & dNextLine '& vbCrLf
            Loop
            Txt(i).Text = dText
    End Sub
    I also attached source project
    Sorry for my poor english
    Please solve my problem
    thanks all
    Attached Files Attached Files

Tags for this Thread

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