Before Close

The BeforeClose event handler enables you to take action before the document closes. For example, you can programmatically cache data in the document before you close it. The code in Listing 6.36 assumes that you have a dataset named ds.

Listing 6.36. Caching data in a document before it closes

Private Sub ThisDocument_BeforeClose(ByVal sender As Object, _ ByVal e As System.ComponentModel.CancelEventArgs) _ Handles Me.BeforeClose

If Not (Me.IsCached("ds")) Then

Me.StartCaching("ds") End If Me.Save()

End Sub

0 0

Post a comment