Tạo hộp thoại chọn và đọc file *.txt bằng VB.Net

Imports System.IO

Private Sub bt_Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_Open.Click
        Dim Open_File As String
        Dim OpenFileDialog1 As New OpenFileDialog()
        OpenFileDialog1.Filter = "Text File (*.txt)|*.txt"
        OpenFileDialog1.Title = "Chọn file *.txt để mở"
        OpenFileDialog1.ShowDialog()
        If OpenFileDialog1.FileName <> "" Then
            Open_File = OpenFileDialog1.FileName
           Dim AllText() As String = File.ReadAllLines(Add)
            For Each Line In AllText
                ''
            Next
        End If
End Sub

Không có nhận xét nào:

Đăng nhận xét