How can I read data from a text file using VB6?

前端 未结 7 1643
悲哀的现实
悲哀的现实 2020-12-06 07:22

I need to read data from text files and use the same in my application. Im using VB 6.0. What commands do I use? Some Sample code would be highly appreciated.

7条回答
  •  遥遥无期
    2020-12-06 08:03

    Make sure your file exists:

    If myFSO.FileExists(IN_sFilePath) Then
        Set myTextStream = myFSO.OpenTextFile(IN_sFilePath, ForReading)
        myString = myTextStream.ReadAll()
        Call myTextStream.Close
    End If
    'Assign Return Value
    ReadTextFileAsString = myString
    

提交回复
热议问题