I know this may seam odd but I'm getting an error navigating through a datagrid of an invalid cast. The trouble is it is of the same types!! I working on customising some Sage code and in the form there is a datagrid that is populated by a series of Sage.Accounting.Stock.TraceableSOPAllocationItems (a batched stock item allocated to an SOP).
I want to give the user some further information on each item so they can decide which batch and bin to use. I want to go through each item in the grid and then go find this extra information for it. the trouble is when I go to navigate through, My VB.Net code throws the error
InvalidCastException was unhandled by user code, Unable to cast object of type 'Sage.Accounting.Stock.TraceableSOPAllocationItem' to type 'Sage.Accounting.Stock.TraceableSOPAllocationItem'.
There shouldn't be a cast going on here they are of the same type???? Here is a snipet of my code:
dim AllocatedItem As Sage.Accounting.Stock.TraceableSOPAllocationItem if itemGrid.Datasource isnot Nothing then for each AllocatedItem in itemGrid.Datasource ...... next end if
The error happens when I start looping....
Any ideas would be much appreciated..