Hi,
I made a class that reads an Excel file and makes it into an array (Attached).
It is then supposed to convert the array to DataGridView object. It seems to 'almost' work - It reads the Excel and builds a nice array as can be seen in the debugger and in a temporary text box I added.
When it comes to making the array the DataGrid DataSource, it looks like the grid is accessed and rows are added, but at the same time there is a big error message with the header: "Array was not a one-dimensional array" followed by a list of errors, followed by the text: "To replace this default dialog please handle the DataError event."
I expected DataGridView to handle 2-dimentionals, am I wrong?
What am I doing wrong?
Sam
Know the answer? Post it. Somebody with the same question will find it here.
Sam HobbsRank #107 · 20.5K reputationPosted Nov 8, 2009, 7:23 AM EST
0
Hi Sam.
If you don't mind a guess, one guess is that not all rows have the same number of columns. The other possibility is that some cells have contents that make a third dimension. So you should add the specified error event; you can then diagnose the problem.
Sam HobbsRank #107 · 20.5K reputationPosted Nov 8, 2009, 7:23 AM EST