Friday 3 May 2013

File Read/Write Using VB 6.0

 Dim filenm As Integer
    filenm = FreeFile
    Open "d:\demo.txt" For Input As filenm
    Dim str As String
    Do While Not EOF(filenm)
        Input #filenm, str
        Label1.Caption = Label1.Caption + vbCrLf + str
    Loop

   Open "d:\readme.txt" For Output As #1
    Print #1, Text1.Text
    Close 1

Appending text in a file without overwriting content


Open "d:\readme.txt" For Append As #1
    Print #1, Text1.Text
    Close 1