Hello all,
I'm trying to bind a datagrid (windows forms) with an object tru a
complex schema. Let me show you what I mean thru this example (this is
C# pseudo code) for a better understanding :
I have an object :
class Euro {
int min ;
int max ;
int value;
}
When I create my datagrid, i want to pass a DataTable (or anything
else) that bind a specific property to each columns of my DG like this
:
public Euro[] euros = new Euro[] {
new Euro(1,1,2)
,new Euro(1,2,4)
,new Euro(1,3,4)
......
} ;
DataTable dt=new DataTable();
dt[0][1] = euros[0];
dt[0][2] = euros[1];
dt[0][3] = euros[2]; // etc ...
Each cell of my DataGrid corresponds to a specific member (say
Euro.Value for example) of the "Euro" object (which is slighly
different to "each line of my datagrid correspond to an object", and
"each col correspond to the object's properties")
When the user modifies a cell, I want to automatically update the
corresponding property of the object. When the property is modified
like this : euro.Value = 2, I want to reflect the changes to the
datagrid.
A kind of bi-directionnal data binding.
If someone could help (C# Windows Forms V1.0 or DataGridView C# Windows
Forms V2.0)
Thanks a lot.
Sam
|