Added Error Handler for corrupted table data.

This commit is contained in:
Rich 2014-10-22 20:25:31 +00:00
parent 6098140d26
commit 505bfa467d
2 changed files with 23 additions and 8 deletions

View File

@ -760,8 +760,15 @@ namespace Volian.Controls.Library
MyFlexGrid.Focus();
if (!MyFlexGrid.IsRoTable) // Table ROs are none editable - don't select a table cell
{
MyFlexGrid.Select(0, 0);
MyFlexGrid.FirstEntry = true; // to fix a problem with initial mouse click into table
try
{
MyFlexGrid.Select(0, 0);
MyFlexGrid.FirstEntry = true; // to fix a problem with initial mouse click into table
}
catch (Exception ex)
{
MessageBox.Show("The content of this table is corrupted. You will either need to restore a previous version or delete it.", "Table Corrupted", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
else

View File

@ -58,7 +58,8 @@ namespace Volian.Controls.Library
public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid
{
private bool _Disposed = false;
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
@ -893,11 +894,18 @@ namespace Volian.Controls.Library
Visible = false;
if (Parent is GridItem)
{
System.Drawing.Image img = this.CreateImage();
using (Graphics gr = (Parent as GridItem).CreateGraphics())
{
gr.DrawImage(img, Left, Top);
}
try
{
System.Drawing.Image img = this.CreateImage();
using (Graphics gr = (Parent as GridItem).CreateGraphics())
{
gr.DrawImage(img, Left, Top);
}
}
catch (Exception ex)
{
_MyLog.WarnFormat("Table Content Corrupted");
}
}
Clear();
MergedRanges.Clear();