[Mono-bugs] [Bug 506838] New: DataGridView does not associate with DataTable correctly when databound

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 25 07:34:39 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=506838


           Summary: DataGridView does not associate with DataTable
                    correctly when databound
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: i386
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: M8R-2yr72d at mailinator.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0;
Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET CLR 3.5.30729;
NET CLR 3.0.30618)

Run the following code; you need to add a 'gridMain' datagridview control to
your winforms application.

            DataTable tableMain = new DataTable();
            tableMain.Columns.Add("AccountID", Type.GetType("System.Int32"));
            gridMain.DataSource = tableMain;
            gridMain.Columns[0].HeaderText = "aapje";

The application will crash with the following stacktrace:

Unhandled Exception: System.ArgumentOutOfRangeException: Index is less than 0
or more than or equal to the list count.
Parameter name: index
0
  at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException
(System.String name, System.Object actual, System.String message) [0x00000] 
  at System.Collections.ArrayList.get_Item (Int32 index) [0x00000] 
  at System.Windows.Forms.DataGridViewColumnCollection.get_Item (Int32 index)
[0x00000] 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.DataGridViewColumnCollection:get_Item (int)
  at WindowsFormsApplication1.Form1..ctor () [0x00000] 
  at (wrapper remoting-invoke-with-check) WindowsFormsApplication1.Form1:.ctor
()
  at WindowsFormsApplication1.Program.Main () [0x00000] 

It appears gridMain does not have any columns (so tableMain was not
correctly associated with gridMain). This is a major bug as the datasource
property fails.

Reproducible: Always

Steps to Reproduce:
1. Run code
2. Crash.
3.
Actual Results:  
Crash

Expected Results:  
Runs fine on .NET 2.0

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list