For work I've been tasked with creating some verification programs. So I thought best way to do this is to take their excel sheet and compare the data...
I've been able to open the excel sheet and place it into a DataGridView, but now I'm stumped on how I actually use the data Im seeing...
I.E - The sheet has 2 columns (min) and (max) with about 20 rows of values... I want to be able to compare the data a user inputs against these two columns... so if the user enters the number 20, it makes sure its greater then any of the (min) values and less then any of the (max) values via a text box and button... any ideas?
**Edit**
Ok i figured out I can use the values from a datagrid using the
DataGridMatrix( value,value) but As I'm trying to place it into a text it says it cannot be converted to 'string'.
Oh! Im using VB.net '05 with my excel document being imported from the Excel 8.0 version, and below is my code to read the excel file.
Dim sqlData As String = "SELECT * FROM [Sheet1$]"
Dim xlCon As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=C:\Docum ents and Settings\eneal\ Desktop\matrix. xls;" & _
"Extended Properties=""Ex cel 8.0;HDR=YES"""
Dim conn As New OleDbConnection (xlCon)
Dim db As New OleDbDataAdapte r(sqlData, conn)
Dim dbExcelData As New DataSet
db.Fill(dbExcel Data, "matrix")
Me.DataGridMatr ix.DataSource = dbExcelData.Tab les("matrix")
dbExcelData.Dis pose()
db.Dispose()
conn.Dispose()
I've been able to open the excel sheet and place it into a DataGridView, but now I'm stumped on how I actually use the data Im seeing...
I.E - The sheet has 2 columns (min) and (max) with about 20 rows of values... I want to be able to compare the data a user inputs against these two columns... so if the user enters the number 20, it makes sure its greater then any of the (min) values and less then any of the (max) values via a text box and button... any ideas?
**Edit**
Ok i figured out I can use the values from a datagrid using the
DataGridMatrix( value,value) but As I'm trying to place it into a text it says it cannot be converted to 'string'.
Oh! Im using VB.net '05 with my excel document being imported from the Excel 8.0 version, and below is my code to read the excel file.
Dim sqlData As String = "SELECT * FROM [Sheet1$]"
Dim xlCon As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=C:\Docum ents and Settings\eneal\ Desktop\matrix. xls;" & _
"Extended Properties=""Ex cel 8.0;HDR=YES"""
Dim conn As New OleDbConnection (xlCon)
Dim db As New OleDbDataAdapte r(sqlData, conn)
Dim dbExcelData As New DataSet
db.Fill(dbExcel Data, "matrix")
Me.DataGridMatr ix.DataSource = dbExcelData.Tab les("matrix")
dbExcelData.Dis pose()
db.Dispose()
conn.Dispose()
Comment