[Mono-bugs] [Bug 484989] DataGridView doesn't emit RowStateChanged Event on creation.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 13 12:39:34 EDT 2009


https://bugzilla.novell.com/show_bug.cgi?id=484989

User tom_hindle at sil.org added comment
https://bugzilla.novell.com/show_bug.cgi?id=484989#c1





--- Comment #1 from tom hindle <tom_hindle at sil.org>  2009-03-13 10:39:34 MST ---
An added subtly is that on .NET the RowStateChanged event is NOT emitted when
Row Count is changed, but latter on at somepoint.

using System;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
 public Form1()
 {
  this.Load += new EventHandler(Form1_Load);
  }

  DataGridView m_grid = new DataGridView();

  private void Form1_Load(System.Object sender, System.EventArgs e)
  {
   m_grid.AllowUserToAddRows = false;
   m_grid.ColumnStateChanged += new
DataGridViewColumnStateChangedEventHandler(OnColumnStateChanged);
  m_grid.RowStateChanged += new
DataGridViewRowStateChangedEventHandler(OnRowStateChanged);
  Console.WriteLine("Before RowCount");
  m_grid.RowCount = 3;
  Console.WriteLine("After RowCount");
  this.Controls.Add(m_grid);
  Console.WriteLine("After Add Grid to Controls");
}

 protected virtual void OnRowStateChanged(object sender,
DataGridViewRowStateChangedEventArgs e)
 {
  Console.WriteLine("OnRowStateChanged {0}", e.Row);
 }

 protected virtual void OnColumnStateChanged(object sender,
DataGridViewColumnStateChangedEventArgs e)
 {
  Console.WriteLine("OnColumnStateChanged {0}", e.Column);
 }

 [STAThreadAttribute()]
 static void Main()
 {
  Application.Run(new Form1());    
 }
}

-- 
Configure bugmail: https://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