Hello,

I try to use a DataGridView with a collection of IronPython objects.
The intention is to use the DataSource  property of the DataGridView
and let the columns be automatically defined.

Something like:
----
class MyDataObject :
   def __init__(self, a, b, c):
       # ...
       pass

f = Form( Name="Test")
dataGrid = DataGridView()

data = [ MyDataObject( 11, 12, 13 ) ]
# or
#data = [ [11, 12, 13 ] ]
dataGrid.DataSource = data
f.Controls.Add(dataGrid)
Application.Run(f)
----
This gives an exception (see below)

And I can't figure out which methods the objects or the container need to
provide
to get the column names.

Do I have to "implement" IListSource for the container?

Any help appreciated

Regards,
Claudius

The exception I get is:

From  System.MissingMemberException: 'instance' object has no attribute
'Get'
  at IronPython.Runtime.Operations.PythonOps.GetBoundAttr(CodeContext
context, Object o, SymbolId name)
  at
IronPython.Runtime.Operations.CustomTypeDescHelpers.SuperDynamicObjectPropertyDescriptor.GetValue(Object
component)
  at System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetValue(Int32
boundColumnIndex, Int32 columnIndex, Int32 rowIndex)
From  System.MissingMemberException: 'instance' object has no attribute
'Set'
  at IronPython.Runtime.Operations.PythonOps.GetBoundAttr(CodeContext
context, Object o, SymbolId name)
  at
IronPython.Runtime.Operations.CustomTypeDescHelpers.SuperDynamicObjectPropertyDescriptor.GetValue(Object
component)
  at System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetValue(Int32
boundColumnIndex, Int32 columnIndex, Int32 rowIndex)
From  System.MissingMemberException: 'instance' object has no attribute
'Address'
  at IronPython.Runtime.Operations.PythonOps.GetBoundAttr(CodeContext
context, Object o, SymbolId name)
  at
IronPython.Runtime.Operations.CustomTypeDescHelpers.SuperDynamicObjectPropertyDescriptor.GetValue(Object
component)
  at System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetValue(Int32
boundColumnIndex, Int32 columnIndex, Int32 rowIndex)
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to