[IronPython] IronPython objects as DataSource for DataGridView

Luis M. González luismg at gmx.net
Thu Jul 19 05:10:29 CEST 2007


This has been filed as a bug sometime ago, and I believe it's supposed to be fixed in the next release...

  ----- Original Message ----- 
  From: C L 
  To: Discussion of IronPython 
  Sent: Wednesday, July 18, 2007 9:00 PM
  Subject: [IronPython] IronPython objects as DataSource for DataGridView


  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
  users at lists.ironpython.com
  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070719/f919c988/attachment.html>


More information about the Ironpython-users mailing list