[IronPython] Strange data binding

Patrick O'Brien sum.ergo.code at gmail.com
Mon Dec 4 01:25:06 CET 2006


The results of running this code are very strange, but may help someone
track down how to bind a data grid view to a list of python objects.  The
following three columns get created: Count, SyncRoot, and IsSynchronized.
Does this make sense to anyone?


import clr
import System

clr.AddReference('System.Windows.Forms')
import System.Windows.Forms as SWF


class Form(SWF.Form):

    def __init__(self):
        SWF.Form.__init__(self)
        data = [
            ('Joe', 23),
            ('Bob', 8),
            ('Thomas', 32),
            ('Patrick', 41),
            ('Kathy', 19),
            ('Sue', 77),
            ]
        grid = SWF.DataGridView()
        grid.AutoGenerateColumns = True
        grid.DataSource = data
        grid.Dock = SWF.DockStyle.Fill
        self.Controls.Add(grid)


if __name__ == '__main__':
    SWF.Application.EnableVisualStyles()
    form = Form()
    SWF.Application.Run(form)


-- 
Patrick K. O'Brien
Orbtech       http://www.orbtech.com
Schevo        http://www.schevo.org
Louie         http://www.pylouie.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20061203/91381ab0/attachment.html>


More information about the Ironpython-users mailing list