[Mono-bugs] [Bug 486881] New: DataGridView: Use of DataGridViewTextBoxColumn causes CurrentRow and CurrentCell to be invalid in VisibleChanged Event Handler
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Mar 19 11:21:02 EDT 2009
https://bugzilla.novell.com/show_bug.cgi?id=486881
Summary: DataGridView: Use of DataGridViewTextBoxColumn causes
CurrentRow and CurrentCell to be invalid in
VisibleChanged Event Handler
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: tom_hindle at sil.org
QAContact: mono-bugs at lists.ximian.com
Found By: ---
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7)
Gecko/2009030422 Ubuntu/8.04 (hardy) Firefox/3.0.7
Sample code which demostrates the problem.
In .NET CurrentRow and CurrentCell are valid refs, in mono they are both null.
using System;
using System.Drawing;
using System.Windows.Forms;
class MyDataGridView : DataGridView
{
public MyDataGridView()
{
AllowUserToAddRows = false;
}
protected override void OnHandleCreated(EventArgs e)
{
DataGridViewColumn wsCol = new DataGridViewColumn();
wsCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
wsCol.DefaultCellStyle.ForeColor = SystemColors.ControlText;
wsCol.DefaultCellStyle.BackColor = SystemColors.Control;
wsCol.ReadOnly = true;
wsCol.CellTemplate = new DataGridViewTextBoxCell();
Columns.Insert(0, wsCol);
base.OnHandleCreated(e);
}
protected override void OnVisibleChanged(EventArgs e)
{
base.OnVisibleChanged(e);
DataGridViewColumn col = new DataGridViewTextBoxColumn();
Columns.Add(col);
Rows.Add(new DataGridViewRow());
Console.WriteLine(CurrentRow != null);
Console.WriteLine(CurrentCell != null);
}
}
public class Form1 : System.Windows.Forms.Form
{
public Form1()
{
this.Load += new EventHandler(Form1_Load);
}
private void Form1_Load(System.Object sender, System.EventArgs e)
{
DataGridView grid = new MyDataGridView();
this.Controls.Add(grid);
}
[STAThreadAttribute()]
static void Main()
{
Application.Run(new Form1());
}
}
Reproducible: Always
Steps to Reproduce:
1. Compile and run Sample code
2.
3.
Actual Results:
False
False
Expected Results:
True
True
--
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