Can I bind multidimensional data to a DataGridView in C # and .NET?

I am looking for an application development that presents worksheets, subclasses from a DataGridView. Users can insert (or import) CSV-like data into a worksheet, and this will be reflected in the data structure in memory - my first guess would be a 2D array of floats.

A DataGridView can be bound to objects with a specific set of interfaces (i.e. IList, IListSource, etc.), and therefore theoretically I can create a class that encapsulates a 2D array and implements one of these interfaces. However, the bewilderment is that interface specifications seem to only serve 1-dimensional arrays - for example, IList . What's happening?!

Update: From the answers, it seems that IList is serving lists of objects. Is there a way to bind a multidimensional array of arbitrary size (float) to a DataGridView? Or is it okay to use the DataGridView itself as a data structure for storing floats?

+5
source share
3 answers

I already did something similar before, here - is a 2D array in IList; may be useful.

+3
source

. IList . . , 2D-. , - . - :

list[0] --> Name, (think of this as list[0]["Name"])
            Age, (think of this as list[0]["Age"])
            Height  (think of this as list[0]["Height"])


list[1] --> Name, (think of this as list[1]["Name"])
            Age, (think of this as list[1]["Age"])
            Height  (think of this as list[1]["Height"])

, , , , , , DataGridView.

, .

+2

CodeProject, , 2D- DataGridView.

+2

All Articles