PC Review


Reply
Thread Tools Rate Thread

Datagrid complex binding

 
 
Sam
Guest
Posts: n/a
 
      7th Oct 2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex DataGrid Binding =?Utf-8?B?RGF2ZQ==?= Microsoft Dot NET Framework 1 6th Sep 2005 04:24 PM
Complex DataGrid Binding =?Utf-8?B?RGF2ZQ==?= Microsoft Dot NET Framework Forms 0 6th Sep 2005 03:20 PM
Complex DataGrid Binding =?Utf-8?B?RGF2ZQ==?= Microsoft C# .NET 0 6th Sep 2005 03:20 PM
DataGrid Binding to Complex Custom Collection Conawapa11 Microsoft ASP .NET 1 14th Nov 2003 11:59 AM
DataGrid Complex Binding K Microsoft C# .NET 5 17th Sep 2003 08:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:58 AM.