Skip to content

Commit

Permalink
Nicer error message regarding layout columns
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed May 18, 2023
1 parent cc33e8e commit 1e2412f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions FetchXmlBuilder/DockControls/ResultGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public partial class ResultGrid : WeifenLuo.WinFormsUI.Docking.DockContent
private FetchXmlBuilder form;
private QueryInfo queryinfo;
private bool reloaded;
private DateTime lasterrormessage;

public ResultGrid(FetchXmlBuilder fetchXmlBuilder)
{
Expand Down Expand Up @@ -135,9 +136,20 @@ internal void SetLayoutToGrid()
var col = crmGridView1.Columns[cell.Name];
if (col != null)
{
col.DisplayIndex = Math.Min(cell.DisplayIndex, crmGridView1.Columns.Count - 1);
col.Width = cell.Width;
col.Visible = cell.Width > 0;
try
{
col.DisplayIndex = Math.Min(cell.DisplayIndex, crmGridView1.Columns.Count - 1);
col.Width = cell.Width;
col.Visible = cell.Width > 0;
}
catch (Exception ex)
{
if (lasterrormessage < DateTime.Now.AddMinutes(-1))
{
MessageBox.Show($"Oops - unexpcted error. But never mind, just try again...\n\n{ex}");
lasterrormessage = DateTime.Now;
}
}
}
}
reloaded = false;
Expand Down

0 comments on commit 1e2412f

Please sign in to comment.