Check out SelectionChanged event of the tab control.
EDIT: Changes to Question
You wish to cancel the event or cancel the save?
For canceling the save, it's just a matter of asking the user something along these lines:
Dim msRes as MessageResult = MessageResult.No
If mySwitchedFromTab.IsDirty Then
msRes = msgbox("Save changes to previous tab?", YesNo, "MyApp")
if msRes = MessageResult.Yes Then
SaveMethod()
End If
End If
Now for canceling the TAB Change, then you've got to deal with booleans, and controlling if the functionality within the event handler will fire or not, and then setting the selected tab back to the previous tab, something along these lines:
If myGlobalTabFireBoolean Then
Dim msRes as MessageResult = MessageResult.No
If mySwitchedFromTab.IsDirty Then
msRes = msgbox("Save changes to previous tab?", YesNoCancel, "MyApp")
Select Case msRes
Case MessageResult.Yes
SaveMethod()
Case MessageResult.Cancel
myGlobalTabFireBoolean = False
myTabContainer.SelectedItem = myPreviousTab
Case Else
' Do Nothing
End If
End If
Else
myglobalTabFireBoolean = True
End IF
Now these are not the only way to perform this type of functionality, as it depends personal coding style, and even such things as how you build your tab items (I build my tabitem's tabs a lot more detailed, so that I can override it's standard behavior, and make them act more like the tabs in Firefox and IE with the "X" button and the middle-mouse-button click to close).