473,378 Members | 1,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Data binding to another object

Hi all,

I've sorted out binding to and from my business entities, however....
Pulling data from the business entities is easy using the
<control>.DataBindings.Add(..) method. These bindings take care if
themselves from UI.
Pushing data from these objects was a bit more problematical, but discovered
that the data binder listens for <PropName>Changed events, and that it only
takes one property/event to trigger an update for the bound data object. To
create a generic "push" method in my business entities, I declared a
property in my base entity class and a method (.e.g. UpdateBound()) that
sets the common property (i.e. Entity.Data) to be Entity.Data (itself) - and
in the Data property, on the set() method i fire a DataChanged event which
the data binder handles and refreshes the bound controls for the data
object.
As long as the property in the base entity is bound to a control's property
it work fine.

This is my problem, in some cases I will need to manage mutiple business
entities from within a form so I need to know if it's possible to create
like a custom bindings for my business entities. for example bind property X
of object A to property Y of object B ?

TIA

Sam
Nov 16 '05 #1
1 1982
Sam,

Unfortinately, there is nothing that does that in .NET right now. I
recommend having a controller class, which has references to the two
objects, and then having it coordinate the setting of the property when the
events are fired (you could use reflection in the same way).

You ^might^ be able to get away with extending BindingsCollection, but I
don't know how much plumbing it will provide. If it provides enough, you
might be able to use it on your objects.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:e$*************@TK2MSFTNGP14.phx.gbl...
Hi all,

I've sorted out binding to and from my business entities, however....
Pulling data from the business entities is easy using the
<control>.DataBindings.Add(..) method. These bindings take care if
themselves from UI.
Pushing data from these objects was a bit more problematical, but
discovered that the data binder listens for <PropName>Changed events, and
that it only takes one property/event to trigger an update for the bound
data object. To create a generic "push" method in my business entities, I
declared a property in my base entity class and a method (.e.g.
UpdateBound()) that sets the common property (i.e. Entity.Data) to be
Entity.Data (itself) - and in the Data property, on the set() method i
fire a DataChanged event which the data binder handles and refreshes the
bound controls for the data object.
As long as the property in the base entity is bound to a control's
property it work fine.

This is my problem, in some cases I will need to manage mutiple business
entities from within a form so I need to know if it's possible to create
like a custom bindings for my business entities. for example bind property
X of object A to property Y of object B ?

TIA

Sam

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
1
by: Patrick | last post by:
Hi all, New to .NET, I'm working on an Winforms client application using VS 2005 beta2. My needs considering data storage are the followings: (1) Small files (0 < length < 10 mb), containing...
6
by: Brad | last post by:
I have a web service which returns a collection of class object (see below). I want to consume this service in another web application by binding it to a List control The data returns from the...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
4
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
19
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this...
0
by: Larry Serflaten | last post by:
I am not sure how many are aware of this sort of data binding, but as it is new to many (classic) VB developers I thought I would post this once just to let people know of its availablility. ...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
9
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.