Type | Description | |||
String | A string expression that indicates the current selection's text. |
Returns the text that the user selected in a text-entry area of a control, or returns an empty string ("") if no characters are selected. Specifies the string containing the selected text. Not available at design time; read-write at run time. The SelStart property returns or sets the starting point of text selected; indicates the position of the insertion point if no text is selected. Use the SelLength property to get the selection's length. The control fires the SelChange event when the user changes the selection. The CursorPos property specifies the position of the cursor inside the text. The CursorText property gets or sets the text between giving coordinates, formatted or unformatted. The Find method finds and selects programmatically a string within the control's text.
The following VB sample displays the selected text when the user changes it:
Private Sub HTML1_SelChange() If Not HTML1.SelText = "" Then Debug.Print HTML1.SelText End If End Sub
The following C++ sample displays the selected text when the user changes it:
void OnSelChangeHTML1() { OutputDebugString( m_html.GetSelText() ); }
The following VB.NET sample displays the selected text when the user changes it:
Private Sub AxHTML1_SelChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxHTML1.SelChange With AxHTML1 Debug.WriteLine(.SelText) End With End Sub
The following C# sample displays the selected text when the user changes it:
private void axHTML1_SelChange(object sender, EventArgs e) { System.Diagnostics.Debug.WriteLine(axHTML1.SelText); }
The following VFP sample displays the selected text when the user changes it:
*** ActiveX Control Event *** with thisform.HTML1 wait window nowait .SelText endwith