Collapse the table of content
Expand the table of content

IsStrict Property

Visual Studio .NET 2003

Returns whether the undo stack linkage is strict.

[Visual Basic .NET]
Public ReadOnly Property IsStrict() As Boolean
[Visual Basic 6]
Property Get IsStrict() As Boolean
HRESULT __stdcall get_IsStrict(
   /* [out, retval] */ VARIANT_BOOL* retVal
public bool IsStrict {get;}
[JScript .NET]
public function get IsStrict() : Boolean

Return Value

True if the undo stack linkage is set to strict, False if not.


If the linkage is strict, the name in the undo drop-down list has a "+" in front of it.


This example removes all newline characters from a block of selected text:

Sub IsStrictExample()
   ' Before running, select text in an open document.
   Dim txtSel As TextSelection
   Dim strTS As String, strAnswer As String, bIsOpen As Boolean
   txtSel = DTE.ActiveDocument.Selection
   strTS = txtSel.Text

   ' Check to see if UndoContext object is already open.
   If DTE.UndoContext.IsOpen = True Then
      bIsOpen = True
       ' Open the UndoContext object to track changes.
       DTE.UndoContext.Open("RemoveNewLines", False)
   End If
   MsgBox("Current IsAborted value: " & DTE.UndoContext.IsAborted & vbCr & "Current IsStrict value: " & DTE.UndoContext.IsStrict)

   ' Perform search for newline characters and remove them.
   If strTS <> "" Then
      strTS = Replace(strTS, vbNewLine, "", Compare:=vbTextCompare)
   End If

   ' Check to see if you want to discard changes.
   strAnswer = MsgBox("Do you want to discard all changes made?", vbYesNo & vbQuestion)
   If strAnswer = True Then
      MsgBox("Current IsAborted value: " & DTE.UndoContext.IsAborted & vbCr & "IsStrict value: " & DTE.UndoContext.IsStrict)
   End If

   ' If UndoContext was already open, don't close it.
   If bIsOpen = True Then
      ' Close the UndoContext object to commit the changes.
   End If
End Sub

See Also

Applies To: UndoContext Object

© 2015 Microsoft