Click here to Skip to main content
15,881,600 members
Articles / Web Development / ASP.NET

Delegates and Business Objects

Rate me:
Please Sign up or sign in to vote.
4.90/5 (100 votes)
21 May 20069 min read 279.7K   2.5K   268  
An approach to implementing validation on custom business rules, using delegates.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DelegateBusinessObjects {
    public partial class MainForm : Form {
        public MainForm() {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e) {
            Customer customer = new Customer();
            customer.Name = "Paul Stovell";
            customer.EmailAddress = "paul.stovell@readify.net";
            customer.DateOfBirth = new DateTime(1986, 10, 17);
            customer.TelephoneNumber = "0431 713 510";

            customerBindingSource.DataSource = customer;
        }

        private void SaveButton_Clicked(object sender, EventArgs e) {
            MessageBox.Show("Saved.");
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Octopus Deploy
Australia Australia
My name is Paul Stovell. I live in Brisbane and develop an automated release management product, Octopus Deploy. Prior to working on Octopus I worked for an investment bank in London, and for Readify. I also work on a few open source projects. I am a Microsoft MVP for Client Application Development.

Comments and Discussions