Spreadsheet in C# [modified]
-
I have an excel spreadsheet where i can input some data and it does a number of calculations on that data. The calculations are quite complex as they rely on the results of other calculations within the spreadsheet. I am looking for a way to basically cut and paste the functionality and format of the spreadsheet into a C# program. I have has a little experience with datatable but i am no expert. Is there a way that i can setup a datatable with some inputs in the first few columns and then setup expressions to populate the remainder of spreadsheet. I am using visual studio express 2008. I know I can just use while loops but I was thinking there could be a simpler way to do it in VS Any help would be appreciated.
modified on Tuesday, November 18, 2008 10:49 PM
-
I have an excel spreadsheet where i can input some data and it does a number of calculations on that data. The calculations are quite complex as they rely on the results of other calculations within the spreadsheet. I am looking for a way to basically cut and paste the functionality and format of the spreadsheet into a C# program. I have has a little experience with datatable but i am no expert. Is there a way that i can setup a datatable with some inputs in the first few columns and then setup expressions to populate the remainder of spreadsheet. I am using visual studio express 2008. I know I can just use while loops but I was thinking there could be a simpler way to do it in VS Any help would be appreciated.
modified on Tuesday, November 18, 2008 10:49 PM
A DataGrid or DataGridView is not a spreadsheet, nor does it work like one. You cannot put formulas in cells and expect them to work on other cells like excel does. You CAN put numbers into certain cells, but you have to provide all the code to do the calculations and put the results in whatever cells you need, then continue with more calculations as needed. Frankly, if you require that functionality, keep the stuff in Excel and write an Add-In for Excel to do whatever else you need. Google for "Visual Studio Tools for Office" for more information and downloads.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
A DataGrid or DataGridView is not a spreadsheet, nor does it work like one. You cannot put formulas in cells and expect them to work on other cells like excel does. You CAN put numbers into certain cells, but you have to provide all the code to do the calculations and put the results in whatever cells you need, then continue with more calculations as needed. Frankly, if you require that functionality, keep the stuff in Excel and write an Add-In for Excel to do whatever else you need. Google for "Visual Studio Tools for Office" for more information and downloads.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008thanks. I thought that was the case but i just wanted to check.