can anyone help me on how to know EOF of excel using vb.net?
i have this code but it crash when i try delete the proceeding rows from row 6 to downward.
my problem is, my code was still reading a null values of rows that i deleted in excel..
this is my code:
Dim xlsConn As New OleDbConnection
Dim xlsAdapter As New OleDbDataAdapter
Dim xlsDataSet As New DataSet
xlsConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathName & " ; Extended Properties=Excel 8.0")
strSQL = "SELECT * FROM [Sheet1$]"
xlsAdapter.SelectCommand = New OleDbCommand(strSQL, xlsConn)
xlsDataSet.Clear()
xlsAdapter.Fill(xlsDataSet)
ListView1.Items.Clear()
Dim listItem As ListViewItem
For ctr As Integer = 0 To xlsDataSet.Tables(0).Rows.Count - 1
listItem = ListView1.Items.Add(xlsDataSet.Tables(0).Rows(ctr).Item("EmpNo").ToString)
listItem.SubItems.Add(xlsDataSet.Tables(0).Rows(ctr).Item("EmpName").ToString)
Next
Can anyone help me to fix this bugs!