TextBoxBase.EndChange Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Termina um bloco de mudança.
public:
void EndChange();
public void EndChange();
member this.EndChange : unit -> unit
Public Sub EndChange ()
Exemplos
O exemplo seguinte mostra como usar os BeginChange métodos e EndChange para criar um bloco de mudança.
TextBox myTextBox = new TextBox();
// Begin the change block. Once BeginChange() is called
// no text content or selection change events will be raised
// until EndChange is called. Also, all edits made within
// a BeginChange/EndChange block are wraped in a single undo block.
myTextBox.BeginChange();
// Put some initial text in the TextBox.
myTextBox.Text = "Initial text in TextBox";
// Make other changes if desired...
// Whenever BeginChange() is called EndChange() must also be
// called to end the change block.
myTextBox.EndChange();
Dim myTextBox As New TextBox()
' Begin the change block. Once BeginChange() is called
' no text content or selection change events will be raised
' until EndChange is called. Also, all edits made within
' a BeginChange/EndChange block are wraped in a single undo block.
myTextBox.BeginChange()
' Put some initial text in the TextBox.
myTextBox.Text = "Initial text in TextBox"
' Make other changes if desired...
' Whenever BeginChange() is called EndChange() must also be
' called to end the change block.
myTextBox.EndChange()
Observações
Note
Quando chamar BeginChange, também deve chamar EndChange para completar o bloco de alteração, caso contrário será lançada uma exceção.
Um bloco de mudança agrupa logicamente múltiplas alterações numa única unidade de desfazer e impede que conteúdos de texto ou eventos de alteração de seleção sejam ativados até depois do bloco de alteração. Desta forma, pode fazer várias edições ao elemento de texto sem o perigo de o elemento ser alterado ao mesmo tempo por outro processo. Um bloco de alteração é criado ao chamar o DeclareChangeBlock método. Chamar o BeginChange método faz com que todas as alterações subsequentes sejam incluídas no bloco de alteração especificado até que seja feita uma chamada correspondente ao EndChange método.