![]() | Type | Description |
Use the SelChange event to notify your application that the selected text was changed. The SelChange event is called even if the selection is empty and user moves the cursor. The SelChange event is called anytime when the position of the cursor was changed. Use the SelText property to get the selected text. Use the GetSelection method to determine the coordinates of the selected text. The SelStart and SelLenght properties determine the position of the selected text. Use the SelForeColor and SelBackColor properties to specify the colors for the selected text.
The following VB sample displays the selected text when the user changes it:
Private Sub Edit1_SelChange()
If Not Edit1.SelText = "" Then
Debug.Print Edit1.SelText
End If
End Sub
The following C++ sample displays the selected text when the user changes it:
void OnSelChangeEdit1()
{
OutputDebugString( m_edit.GetSelText() );
}
The following VB.NET sample displays the selected text when the user changes it:
Private Sub AxEdit1_SelChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxEdit1.SelChange
With AxEdit1
Debug.WriteLine(.SelText)
End With
End Sub
The following C# sample displays the selected text when the user changes it:
private void axEdit1_SelChange(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine(axEdit1.SelText);
}
The following VFP sample displays the selected text when the user changes it:
*** ActiveX Control Event *** with thisform.Edit1 wait window nowait .SelText endwith