[Mono-bugs] [Bug 81003][Nor] New - When adding rows to an already bound DataTable, the DataGridView is not refreshed to show the new rows
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Mar 2 10:32:31 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=81003
--- shadow/81003 2007-03-02 10:32:31.000000000 -0500
+++ shadow/81003.tmp.13472 2007-03-02 10:32:31.000000000 -0500
@@ -0,0 +1,84 @@
+Bug#: 81003
+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: When adding rows to an already bound DataTable, the DataGridView is not refreshed to show the new rows
+
+The code below works as expected with SWF (after each button click the view
+is refreshed to show all the rows) but with MWF the new rows are not displayed:
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Data;
+
+public class NoRefreshApp
+{
+ static void Main()
+ {
+ Application.Run( new NoRefreshForm() );
+ }
+}
+
+public class NoRefreshForm : Form
+{
+ private DataTable dt;
+ private DataGridView grid;
+ private Button button;
+
+ public NoRefreshForm()
+ {
+ dt = new DataTable();
+ dt.Columns.Add("Date", typeof(DateTime));
+ dt.Columns.Add("Event", typeof(string));
+
+ DataRow row = dt.NewRow();
+ row["Date"] = DateTime.Now;
+ row["Event"] = "n/a";
+ dt.Rows.Add(row);
+
+ button = new Button();
+ button.FlatStyle = FlatStyle.System;
+ button.Click += new EventHandler(button_Click);
+ button.Location = new Point(8, 8);
+ button.Name = "AddRow";
+ button.Text = "AddRow";
+ Controls.Add(button);
+
+ 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(8, button.Height * 2);
+ grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ grid.DataSource = dt;
+ Controls.Add(grid);
+
+ Show();
+ }
+
+ private void button_Click(object sender, System.EventArgs e)
+ {
+ DataRow r = dt.NewRow();
+ r[0] = DateTime.Now;
+ r[1] = "Button.Click";
+ dt.Rows.Add(r);
+ }
+}
More information about the mono-bugs
mailing list