Click here to Skip to main content
12,512,689 members (28,309 online)
Click here to Skip to main content
Articles » Languages » C# » Utilities » Downloads

Stats

9.3K views
98 downloads
10 bookmarked
Posted

SmartLists - Extended Lists with Events

, 29 Sep 2010 BSD
SmartLists library is a collection of classes that extends the standard C# List object
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Odbms.SmartLists;

namespace SmartListsTest
{
    public partial class Form1 : Form
    {
        private EventList<Book> _books = new EventList<Book>();

        public Form1()
        {
            InitializeComponent();

            _books.Add(new Book("Bill Gates", "Business @ the speed of thought"));
            _books.Add(new Book("Giacomo Casanova", "The story of my life"));

            this.grid.AutoGenerateColumns = false;
            this.grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            this.grid.Columns[0].DataPropertyName = "Author";
            this.grid.Columns[1].DataPropertyName = "Title";

            EventListBinding<Book> source = _books.CreateBinding();
            source.AddingNew += new AddingNewEventHandler(source_AddingNew);
            this.grid.DataSource = source;
        }

        void source_AddingNew(object sender, AddingNewEventArgs e)
        {
            e.NewObject = new Book("Insert Author", "Insert Title");
        }
    }
}

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, along with any associated source code and files, is licensed under The BSD License

Share

About the Author

Luigi Grilli
Software Developer (Senior)
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160929.1 | Last Updated 30 Sep 2010
Article Copyright 2010 by Luigi Grilli
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid