This project is read-only.

Setting Rowspan across non null cells

Feb 28, 2011 at 11:06 PM

I am new to Sourcegrid and this form, so please excuse this question which is most basic.

I am trying to span across rows where the cells were previously set, I believe I should set the cell to Null, however this is not working in 2005 with error 'Unable to Cast obkect of type System.DBNull to SourceGrid.cells.ICell'

The code I am using is Grid1(1,1) = DBNull.Value

What is the correct way of setting a cell back to null ?

Any help would be much appreciated.


Mar 1, 2011 at 1:35 AM

Did you try

Grid1(1,1) =null


Mar 1, 2011 at 8:49 AM

Thanks for the reply, Using 'Null' was my first shot at it.

The compiler errors with 'Null is no longer supported, use System.DBNull instead', which does compile but errors at runtime as above.


Mar 2, 2011 at 9:41 AM

Em...  I am not expert in VB.Net, but try this:

Mar 2, 2011 at 10:14 AM

Thanks again, I had already tried 'Nothing', again this compiles however the sourcegrid does not recognise the cell to be spanned as 'Null' or Blank with message 'Cannot Change Span'.

I am assuming the problem is that the cell had previously been assigned a value and therefore can't span it, I have checked the source for the planning grid that does a similar thing to what I am attempting and in c# the cell is simply set to null before spanning. Unfortunately I dont have above 2005 so I can't play around with the source perhaps by adding a '.clearcell' option which simply sets the cell to null, however I am surprised that this is prooving difficult in vb when it is simple in c#.




Mar 3, 2011 at 10:30 AM

In order to proceed I have been looking at the ClearCell Option, I now have the source loaded & believe I can see a way to achieve this, although C# is really new territory for me. I am unable to compile the source however with 18 errors, all of the same issue

'SourceGrid.Grid.EnableSort.get' must declare a body because it is not marked abstract or exterm

if I can get past this I may be able to sort my original problem.

Again Any help is much appreciated.

Mar 4, 2011 at 10:41 AM

>> Unfortunately I dont have above 2005

You can always use free software, such as SharpDevelop, which supports all .Net versions

Mar 4, 2011 at 10:14 PM

Thanks, I downloaded SharpDevelop, loaded up the grid source and compiled without the issues I had seen in Visual Studio.

Whilst adding a clear cell option I discovered that Vb 'Nothing' does actually equate to 'null' for the sourcegrid. I dont understand why when I first tried this (days ago) it did not give the expected results, may be I had some stupid typo issues. 

In conclusion my problem is resolved, thanks for all the help, and to summarise, in order to be able to span a cell that has already been set in VB clear the cell(s) to be spanned with

grid1(row, col) = Nothing