Hi there,
I encountered an interesting error that blocks all user input to the application, and have created a small sample project to demonstrate it.
The error loop occurs when invalid data is entered into a cell (e.g. "three" in a cell expecting an integer), and (while the cell is still active) the MDI child form containing the grid control is closed.
The UltraGrid (to exhibit the full bad behaviour) needs to be contained within another control which itself is contained within an MDI child form.
The MDI Parent form needs to have at least two child forms, or the error box will only fire two or three times, rather than in a loop.
Here some code that demonstrates the problem.
using System; using System.Data; using System.Windows.Forms; using Infragistics.Win.UltraWinGrid; public class ContainerForm : Form { [STAThread] static void Main() { Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ContainerForm()); } public ContainerForm() { this.InitializeComponent(); } private void InitializeComponent() { this.SuspendLayout(); // // ContainerForm // this.ClientSize = new System.Drawing.Size(284, 262); this.IsMdiContainer = true; this.Name = "ContainerForm"; this.Text = "Type some non-numeric text into the integer-only cells in the grid, then close the form"; this.Shown += new System.EventHandler(this.ContainerForm_Shown); this.ResumeLayout(false); } private void ContainerForm_Shown(object sender, EventArgs e) { ChildForm form1 = new ChildForm(); form1.MdiParent = this; form1.Show(); ChildForm form2 = new ChildForm(); form2.MdiParent = this; form2.Show(); } } public class ChildForm : Form { private IntegerGridContainer gridControl; private DataTable dataSource; public ChildForm() { this.gridControl = new IntegerGridContainer(); this.Controls.Add(this.gridControl); // Set up grid with an integer only column. dataSource = new DataTable("TableName"); dataSource.Columns.Add("Integer", typeof(int)); this.gridControl.DataSource = dataSource; } } public class IntegerGridContainer : UltraGrid { public IntegerGridContainer() { // Create UltraGrid this.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TemplateOnBottom; this.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText; } }
I would welcome any suggestions, particularly if the fix does not alter the grid's behaviour the rest of the time. On a related note, is it possible to disable or alter the appearance of the message box that appears when there are Data Errors "Unable to update the data value..." or when the user is deleting a row, etc?Many Thanks,Tom
Hello,
I created a sample using NetAdvantage 2011 Volume 1, and I did not reproduce the issue. The error dialog only showed twice. Please let me know which version of NetAdvantage you were using.
I'm terribly sorry. It's been two years since I posted about the error, and I've long since misplaced the project file.But I did post code in the original post that fully replicates the problem. If you have tried this code and cannot replicate the problem, I'd suggest maybe its been fixed by a prior release.
Hello Tom,
I noticed that you mentioned that you had created a sample project to demonstrate the issue. Would you be able to attach that project to this thread? You can attach a file to a post by selecting the Options tab when you're editing the post.