dv2020
Active member
- Joined
- Dec 18, 2020
- Messages
- 30
- Programming Experience
- 1-3
Hi All,
Found this forum recently which looks great. This is my first post.
I have an application I'm working on which loads a new tab within a tab control when a user selects a date from a data grid.
I can not get this code to execute when a user closes that specific tab e.g 1/1/2020.
I have this code, which removes the selected tab 1/1/2020 which works well, but for that spefic winform instance loaded inside the select tab, it wont run the disposeALLreports();
The tabpages.remove does not trigger the form closing trigger either.
I'm a bit stuck on this one, any ideas?
Thanks in advance
David
Found this forum recently which looks great. This is my first post.
I have an application I'm working on which loads a new tab within a tab control when a user selects a date from a data grid.
- When they select a date, e.g 1/1/2020 a new tab opens within the tabcontrol and the text for that tab is set to 1/1/2020.
- User can open multiple dates, which opens multiple tabs with different dates
- Inside each tab, it loads a new instance of an existing winform.
- Inside that win form, we have a a bit of code.
C#:
public void disposeAllReports()
{
if (this.crystalReportViewer1 != null) { this.crystalReportViewer1.Dispose(); }
if (this.cryRpt != null) { this.cryRpt.Close(); }
if (this.cryRptSum != null) { this.cryRptSum.Dispose(); }
if (this.crystalReportViewerProfileSum != null) { this.crystalReportViewerProfileSum.Dispose(); }
if (this.cryRptSum != null) { this.cryRptSum.Close(); }
if (this.cryRptSum != null) { this.cryRptSum.Dispose(); }
if (this._dbConnectRead.checkConnection() == true) { this._dbConnectRead.CloseConnection(); }
if (this._dbConnectSave.checkConnection() == true) { this._dbConnectSave.CloseConnection(); }
GC.Collect(); // I forgot this line
}
I can not get this code to execute when a user closes that specific tab e.g 1/1/2020.
I have this code, which removes the selected tab 1/1/2020 which works well, but for that spefic winform instance loaded inside the select tab, it wont run the disposeALLreports();
this.tabReportModules.TabPages.Remove(selectedTabPage);
The tabpages.remove does not trigger the form closing trigger either.
I'm a bit stuck on this one, any ideas?
Thanks in advance
David
Last edited by a moderator: