Skip to content

Commit

Permalink
added a condition to check if deleting last sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
N-thony committed Oct 18, 2023
1 parent 6a118ff commit ae53fb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ Public MustInherit Class ucrReoGrid
For i = grdData.Worksheets.Count - 1 To 0 Step -1
Dim iGridWorkheetsPosition As Integer = i 'Needed to prevent warning
If _clsDataBook.DataFrames.Where(Function(x) x.strName = grdData.Worksheets(iGridWorkheetsPosition).Name).Count = 0 Then
grdData.RemoveWorksheet(i)
bDeleted = True
' Check if we are deleting the last worksheet
If grdData.Worksheets.Count > 1 Then
grdData.RemoveWorksheet(i)
bDeleted = True
End If
End If
Next
' Force the grid to refresh if a sheet has been deleted as there is sometimes a UI problem otherwise.
Expand Down
2 changes: 1 addition & 1 deletion instat/ucrDataView.vb
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ Public Class ucrDataView
_clsDataBook.RefreshData()
'If we are updating one cell we do not need to refresh the grid and the
'refresh of that cell will be done manually
_grid.RemoveOldWorksheets()
If Not bOnlyUpdateOneCell Then
AddAndUpdateWorksheets()
_grid.RemoveOldWorksheets()
If _clsDataBook.DataFrames.Count = 0 Then
RefreshDisplayInformation()
End If
Expand Down

0 comments on commit ae53fb2

Please sign in to comment.