Fixed a bug that caused the ModifyRecord form to crash on load if the cursor was over the top left hand header cell. Set a timeout for the restore SQL statement to hopefully prevent a timeout exception from being thrown. Minor code clean up.
This commit is contained in:
@@ -77,14 +77,13 @@ namespace AdvertsingProfitControl
|
||||
|
||||
public NewModifyRecord(DateTime date)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeComponent();
|
||||
//
|
||||
weekEndingCalendar.SelectionStart = date;
|
||||
_currentActiveDate = date;
|
||||
InitializeForm();
|
||||
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
||||
Text = @"Modify Record (Current Record: " + date.ToShortDateString() + @")";
|
||||
_isModifyingRecord = true;
|
||||
LoadDate(date);
|
||||
}
|
||||
|
||||
@@ -2728,6 +2727,14 @@ out double beginningBinCount, out string _))
|
||||
|
||||
public void InitializeForm()
|
||||
{
|
||||
//Apply a little nonsense fix for a but that occurs with the DataGridView control where if a cursor
|
||||
//is placed over the top left hand header cell, it causes an InvalidOperationException. This mainly
|
||||
//effects this form when its overloaded constructor is called since the mouse cursor is right on top
|
||||
//of the aforementioned cell after clicking the "Modify Existing Record" menu option on the main form.
|
||||
//More info one the bug here https://stackoverflow.com/questions/34344499/invalidoperationexception-this-operation-cannot-be-performed-while-an-auto-fill
|
||||
//The following fix is applied to the projections DataGridView since its the first grid displayed to the user.
|
||||
//The fix is simple however, force the form to create the cell as follows:
|
||||
var projectionsLeftHeaderCell = projectionsDataGridView.TopLeftHeaderCell;
|
||||
var db = new AdvertisingProfitControlDbContext();
|
||||
weekEndingCalendar.BoldedDates = db.WeekEndingDates.Select(zdate => zdate.EndingDate).ToArray();
|
||||
weekEndingCalendar.DateChanged += ValidateDateChanged;
|
||||
|
||||
Reference in New Issue
Block a user