_openfildialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
_openfildialog.Filter = "Excel files (*.xlsx)|*.xlsx|CSV Files (*.csv)|*.csv|XLS Files (*.xls)|*xls"
Dim dts As DataSet
Dim excel As String
Dim conn As OleDbConnection
Dim dta As OleDbDataAdapter
If (_openfildialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
Dim fi As New FileInfo(_openfildialog.FileName)
Dim FileName As String = _openfildialog.FileName
excel = fi.FullName
conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excel + ";Extended Properties=Excel 12.0;")
dta = New OleDbDataAdapter("Select * From [Sheet1$]", conn)
dts = New DataSet
dta.Fill(dts, "[Sheet1$]")
_datagridview.DataSource = dts
_datagridview.DataMember = "[Sheet1$]"
conn.Close()
End If