Results 1 to 7 of 7
May 8, 2012, 23:45 #1
- Join Date
- Feb 2012
- Copenhagen, Denmark
- 1 Post(s)
- 0 Thread(s)
Binding a Gridview to data in one dimensional System.Array
I'm working on a project writing an OPC client (a standard in process engineering) and I've come across a little datadesign issue that I could really use your opinions on! Basically the way the OPC server works is you query using a Synchronous read method and essentially after some back of fourth it returns a lot of values in a single messy System.Array, the nature of the client means that this array can be anything from 6 objects to over a thousand or more.
Luckily, as that has to be done is display this allready optimized data in a GridView, but this is where I'm not sure what the best way to do it is. The amount of columns is not dynamic, so that helps a lot but basically I need it to iterate through the Array, insert it into the Grid creating a new row after each 6 values.
My first approach was to write a method that splits the initial Array into a lot of small arrays but surely there's an easier way? I've also been looking into the BindingList object, it seems like something worth using? or maybe a double for-loop?
So in short, I have a dynamic array of values and for each 6 values I need to insert them into a row in a DataTable/GridView - so row1: v1, v2, v3, v4, v5, v6 /new row v7, v8, v9, v10, v11, v12 and so on unto the breach.
Any ideas would be greatly appreciated!
Thanks in advance <3