Tuesday, April 27, 2004

Don't forget to Read the Documentation!

Managed to sort out my datagrid/array problem. I was right. I was forgetting to do something very stupid.

Here's how it works. The Orderlines Property returns an array of orderlines. The Orderlines are stored within the class with a private ArrayList field (FOrderlines). The property then returns FOrderLines.ToArray()...

Or at least it did.

If you do actuallt take the time to read down the page a bit further, there's an overloaded version of .ToArray, ToArray(Type as System.Type). Use the overloaded one and it'll copy your ArrayList to an Array of object of the type you specify, in my case OrderLines = FOrderLines.toarray(gettype(OrderLine)).

If I'd read the rest of the documentation, I'd have known that!

No comments: