DataGridView revamp for Mono 2.4 – Data Binding and more

In December I developed a simple student registration system, where I utilized DataGridView, BindingSources  and the WinForms DataBinding all over the place (developed fully in Visual Studio 2008). Then I ran it only to discover that it was utterly broken on Mono, which pushed me to get down and do some work.

Ladies and Gentlemen, with ~70 commits, 20+ officially filed bugzilla bugs fixed and many dozens of such that weren’t filed and discovered by extensive interactive testing of various test samples and my own application I have revamped the DataGridView and various pieces of DataBinding in Mono’s Windows Forms implementation. Your DataGridView applications should work out of the box (mine does :-) ). Those fixes will be part of the Mono 2.4 release for which we will be branching this month.

Be nice and test your applications with Subversion HEAD or Mono 2.4 branch once it is available (http://mono-project.com/Compiling_Mono) and in case you find any problems be nice and report them to us (http://mono-project.com/Bugs), so that we can fix them for Mono 2.4.

Ciao!

DataGridView SVN HEAD caught in action

DataGridView SVN HEAD caught in action

  • Twitter
  • Facebook
  • FriendFeed
  • StumbleUpon
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Reddit
  • Tumblr
  • PDF
  • Print
  • email
Rating: (No Ratings Yet)
Loading ... Loading ...
Comments
Published: Jan 15th, 2009 (Views: 869)
Categories: Coding
  • johndthomas
    I would be grateful if you coulld post some code here for binding to the DataGridView and its properties. I'm just atarting out in mono - I've got a datagrid working, but the DataGridView is giving me grief
  • The code samples for DataGridView in Microsoft.NET are the same for Mono. If a sample is not working on Mono but is working on MS.NET then it is a bug in Mono's DataGridView which should be reported.
  • Heinz
    Hi Ivan, I'm trying to run a VB.Net application on Mono 2.4.2.3. The application is using ADO.NET and data binding to display data directly on forms. As far as I understand that's exactly the topic you are writing about. If I try to run the application on Mono, I get the following error:

    Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
    ...
    at System.Windows.Forms.BindingSource.ResetList () [0x00141] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\Managed.Windows.Forms\System.Windows.Forms\BindingSource.cs:174
    at System.Windows.Forms.BindingSource.System.ComponentModel.ISupportInitialize.EndInit () [0x0004c] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\Managed.Windows.Forms\System.Windows.Forms\BindingSource.cs:1005
    at ... Form1.InitializeComponent () [0x00c25] in C:\... .Designer.vb:285
    at (wrapper remoting-invoke-with-check) ... Form1:InitializeComponent ()
    at ... Form1..ctor () [0x0005b] in C:\... .Designer.vb:6
    ...

    In order to be sure about the source for the error, I created a new C# project with one form and one dataset (SQlite). I created a textbox on the form and coupled the text property to one field of the dataset. The whole application has got not even one line of handwritten code. It is working with .NET (displays a value from the DB in the text box), but I get exactly the same error while trying to run with Mono as with my other application.

    Now my question: From your description above, I understand that data binding should work with Mono, but from my own tests it seems not. What is the current state or what is my mistake? Thank you for your help.

    Heinz
  • Hey,

    Give Mono 2.6 preview 1 a try - http://mono.ximian.com/monobuild/preview/downlo...

    If that also doesn't help please file a bug http://mono-project.com/Bugs and attach the test case in order to reproduce the bug. Thanks.
  • Heinz
    Hi Ivan, I tried with Mono 2.6 and now I get a different error message:

    Unhandled Exception: System.ArgumentException: Cannot bind to property 'id' on DataSource.
    Parameter name: dataMember
    ...

    The whole message is quiet long and I don't want to post it here. Before I file a new bug, I want to make sure that the mistake is not on my side now. I'm using the System.Data.SQLite provider from here: http://sqlite.phxsoftware.com/, which is an imported assembly laying in my application directory. Might this be the reason for the current error? What data sources/data providers did you use for your test? I saw that there is a Mono.Data.SqliteClient, but I'm not sure how to use it in Visual Studio? Thank you very much.
  • Generally if it works on MS.NET but doesn't on Mono then it's a bug in Mono.

    BTW I see (based on the exception msg) that the DataMember is set to "id". Wouldn't your property be named "Id" (capital i)?

    Again if your app works on MS.NET and not on Mono the best to do is a file a bug.
  • Heinz
    Thanks Ivan, I filed a bug: https://bugzilla.novell.com/show_bug.cgi?id=559603 and attached my small test app.

    'id' is how I named the column in the SQlite database and its spelled with a lower i. Does that make any difference? All the code is generated by VS.

    BW
  • gustavo
    I'm trying the datagridview and I can't edit a cell on mono 2.4, is this supported?
  • Yes it's supported. If your code works in Microsoft .NET but not on mono then file a bug with a test case (small one) at http://mono-project.com/Bugs
  • ivan from the dominican republic, i follow you work, because the winform api implementation is very importan for me, i develop aplications for windows and i like migrate my aplication for suse linux,
  • Great work man! This is going to be a huge win for Mono 2.4. Data binding in DGV has got to be one of the most common use cases in internal corporate winforms apps.
  • Amazing work! Unfortunately, in my team we have found some additional crasher bugs :) Ask mario.
  • Please file them, thanks.
  • I'm sure mario has already filed them :)
  • euphoria
    Thanks! I'll have to test these off of SVN -- My app had some minor problems with binding in a DataGridView on Mono, but it was a very small part of the app. I expect this will make it a bit more polished.
  • Excellent... Well done..

    Pity it won't make 2.2 final..

    Oh well.. Just have to grab the head/2.4 branch...

    Again.. Excellent work..
  • Owen
    I bow down to you in awe of the greatness you have done! Go mono!
blog comments powered by Disqus