Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ofd As New OpenFileDialog()
ofd.Filter = "All file(*.txt,*.scv)|*.txt;*.csv|Text files(*.txt)|*.txt|CSV (*.csv)|*.csv"
Dim _path As String = ""
Dim _filenname As String = ""
Dim dt As New DataTable()
If ofd.ShowDialog() = DialogResult.OK Then
_path = Path.GetDirectoryName(ofd.FileName)
_filenname = Path.GetFileName(ofd.FileName)
Label1.Text = ofd.FileName
Dim conString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _path + ";Extended Properties=""Text;HDR=no;FMT=Delimited"""
Dim conn As New OleDbConnection(conString)
Dim da As New OleDbDataAdapter("Select * from " + _filenname, conn)
da.Fill(dt)
DataGridView1.DataSource = dt
End If
End Sub