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

前端 未结 7 1649
悲哀的现实
悲哀的现实 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:00

    i will refer you a different method to read and import the content to your form window

    public sub readfile
        Dim rtc As TextBox = New TextBox
        rtc.Multiline = True
        rtc.ScrollBars = ScrollBars.Both
        rtc.Width = 400
        rtc.Height = 200
        Me.Controls.Add(rtc)
        rtc.WordWrap = True
        Dim FILE_NAME As String = "C:\Users\vcidex92\Desktop\suji\me.html"
    
        If System.IO.File.Exists(FILE_NAME) = True Then
    
            Dim objReader As New System.IO.StreamReader(FILE_NAME)
            rtc.Text = objReader.ReadToEnd
            objReader.Close()
        Else
    
            MsgBox("File Does Not Exist")
        End If
    end sub
    

提交回复
热议问题