The Artima Developer Community
Sponsored Link

.NET Buzz Forum
DataBinding in .NET 2.0

0 replies.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a flat view of this topic  Flat View
Previous Topic   Next Topic
Threaded View: This topic has 0 replies on 1 page
Darrell Norton

Posts: 876
Nickname: dnorton
Registered: Mar, 2004

Darrell Norton is a consultant for CapTech Ventures.
DataBinding in .NET 2.0 Posted: Apr 5, 2005 12:00 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Darrell Norton.
Original Post: DataBinding in .NET 2.0
Feed Title: Darrell Norton's Blog
Feed URL: /error.htm?aspxerrorpath=/blogs/darrell.norton/Rss.aspx
Feed Description: Agile Software Development: Scrum, XP, et al with .NET
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Darrell Norton
Latest Posts From Darrell Norton's Blog

The databinding support for the .NET Framework version 1.x was the primary reason for using a DataSet. Using it made life much easier, and trying to develop non-DataSet components was correspondingly harder.

But that’s all changed in .NET 2.0. You can bind to a business object very simply. First, you need to add a DataConnector for your business object to your form (or user control). Then, the following three lines of code (this is with Windows Forms, it may be slightly different for ASP.NET 2.0):

// Business Object DataConnector
this.BusinessObjectDataConnector = 
  new System.Windows.Forms.DataConnector(this.components);

this.BusinessObjectDataConnector.DataSource = 
  Services.BusinessObject.BusinessObjectDataClass.Load();

// DataBindings
this.textbox1.DataBindings.Add(
  new Binding("Text", this.BusinessObjectDataConnector, 
  "SomeProperty", true) );

That’s it! Now if you change the value of textbox1, it updates the BusinessObject’s SomeProperty value for you!

Read: DataBinding in .NET 2.0


Topic: Using statement - Why it's so good Previous Topic   Next Topic Topic: CMS.RAPID Partners

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use