Ok i have a question about something I have either forgotten or never knew to begin with. If you have a coulmn and have it set to currencycell and have the cellvaluetype set to system.single how come the cells arent defaulted to zero. Like in one instance i set only 2 cells in a column of 10 rows to have data. If i try and loop through all 10 and compare each cell to greater then zero i get the casting error because the other 8 cells have null values in them. By default wouldnt a system.single be set to zero?
ADAdministrator Syncfusion Team March 11, 2004 09:21 AM
If you are using VB, you can use the Val function to return zero when the value in the cell is the empty string which is what is being displayed when there is no value in the cell.
dim d as double = Val(Me.grid(4, 2).Text)
will return zero when the cell is empty and will return the value when it is not.
If you are using C#, then you will have to conditionally handle this situation.
double d = (this.grid[4,2].Text.Length == 0) ? 0 : double.Parse(this.grid[4,2].Text);