Original DataRestored Event Handler

You can use the OriginalDataRestored event handler to take action when data in a ListObject is automatically restored. The code in Listing 7.33 displays a message box to inform the user that the data cannot be deleted or modified. For example, if you run this code and then try to change the heading "Agency" to "Company," the title automatically resets to "Agency" and the message is displayed.

Listing 7.33. Warning users when a data-bound list object cannot be modified or deleted

Private Sub List1_OriginalDataRestored(ByVal sender As _ Object, ByVal e As Microsoft.Office.Tools.Excel. _ OriginalDataRestoredEventArgs) Handles _ List1.OriginalDataRestored

MsgBox("Data cannot be deleted or modified.")

0 0

Post a comment