01.
ProgressBar1.Visible =
False
02.
If
TxtOpenfile.Text =
""
Then
03.
MsgBox(
"Please input file for Import !!!"
, MsgBoxStyle.OkOnly)
04.
OleDDSet.Reset()
05.
TxtOpenfile.Focus()
06.
Else
07.
OleDDSet.Reset()
08.
Dim
OleConnection
As
New
OleDbConnection(
"provider=Microsoft.Jet.OLEDB.4.0; data source="
& strFileName &
"; Extended Properties=Excel 8.0;"
)
09.
OleCommand =
New
OleDbCommand(
"select * from [Sheet1$]"
, OleConnection)
10.
OleAdapter =
New
OleDbDataAdapter(OleCommand)
11.
OleAdapter.Fill(OleDDSet)
12.
13.
14.
With
DataGridView1
15.
.DataSource = OleDDSet.Tables(0)
16.
End
With
17.
TxtSumLine.Text = OleDDSet.Tables(0).Rows.Count
18.
OleConnection.Close()
19.
End
If