Hi all,
Im currently trying to extract information from excel and display it in a different way so ive managed to pull the info from excel using
my problem then comes i wish to filter the info into serveral datagrid views whereby gridview 1 will only show records where ESN = 91300 and datagrid2 where ESN = 51590 etc
Any help would be greatly appreciated
Kind regards tim
Im currently trying to extract information from excel and display it in a different way so ive managed to pull the info from excel using
Code:
'Open the Excel file using ClosedXML.
Using workBook As New XLWorkbook("C:sktop\test.xlsx")
'Read the first Sheet from Excel file.
Dim workSheet As IXLWorksheet = workBook.Worksheet(1)
'Create a new DataTable.
Dim dt As New DataTable()
Dim totalrows As Integer = workSheet.RowsUsed.Count
'Loop through the Worksheet rows.
Dim firstRow As Boolean = True
For Each row As IXLRow In workSheet.RowsUsed
'Use the first row to add columns to DataTable.
If firstRow Then
For Each cell As IXLCell In row.Cells()
dt.Columns.Add(cell.Value.ToString())
Console.WriteLine(cell.Value.ToString())
Next
firstRow = False
Else
'Add rows to DataTable.
dt.Rows.Add()
Dim i As Integer = 0
For Each cell As IXLCell In row.Cells()
dt.Rows(dt.Rows.Count - 1)(i) = cell.Value.ToString()
If i = 28 Then
Exit For
End If
i += 1
Next
End If
Any help would be greatly appreciated
Kind regards tim