ProgressBar1.Visible = False
If TxtOpenfile.Text = "" Then
MsgBox("Please input file for Import !!!", MsgBoxStyle.OkOnly)
OleDDSet.Reset()
TxtOpenfile.Focus()
Else
OleDDSet.Reset()
Dim OleConnection As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; data source=" & strFileName & "; Extended Properties=Excel 8.0;")
OleCommand = New OleDbCommand("select * from [Sheet1$]", OleConnection)
OleAdapter = New OleDbDataAdapter(OleCommand)
OleAdapter.Fill(OleDDSet)
'OleDDSet.Tables(0).Rows.RemoveAt(0) 'Delete first line
'OleDDSet.Tables(0).Rows.RemoveAt(OleDDSet.Tables(0).Rows.Count - 1) -- Delete last line
With DataGridView1
.DataSource = OleDDSet.Tables(0)
End With
TxtSumLine.Text = OleDDSet.Tables(0).Rows.Count
OleConnection.Close()
End If