[Mono-bugs] [Bug 81002][Nor] New - DataGridView does not show column headers when binding empty DataTable

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Mar 2 10:20:18 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mtraudt at quantifisolutions.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81002

--- shadow/81002	2007-03-02 10:20:18.000000000 -0500
+++ shadow/81002.tmp.13205	2007-03-02 10:20:18.000000000 -0500
@@ -0,0 +1,65 @@
+Bug#: 81002
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: mtraudt at quantifisolutions.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DataGridView does not show column headers when binding empty DataTable
+
+In SWF when binding an empty DataTable to a DataGridView you see the column
+headers, but with MWF you do not.  The following program can be used to
+reproduce the problem:
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Data;
+
+// With SWF we see column headers when this app is run.
+
+public class EmptyTableApp 
+{
+  static void Main() 
+  {
+    Application.Run( new EmptyTableForm() );
+  }
+}
+
+public class EmptyTableForm : Form
+{
+  private DataTable dt;
+  private DataGridView grid;
+
+  public EmptyTableForm()
+  {
+    dt = new DataTable();
+    dt.Columns.Add("Date", typeof(DateTime));
+    dt.Columns.Add("Event", typeof(string));
+
+    grid = new DataGridView();
+    grid.MultiSelect = true;
+    grid.RowHeadersVisible = false;
+    grid.AllowUserToAddRows = false;
+    grid.AllowUserToDeleteRows = false;
+    grid.AllowUserToResizeRows = false;
+    grid.ShowCellToolTips = false;
+    grid.RowTemplate.Height = 18;
+    grid.ReadOnly = true;
+    grid.Location = new Point(0, 0);
+    grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+    grid.DataSource = dt;
+    Controls.Add(grid);
+
+    Show();
+  }
+}


More information about the mono-bugs mailing list