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.
Syntax for SelChange event, /NET version, on:
private void SelChange(object sender) { } Private Sub SelChange(ByVal sender As System.Object) Handles SelChange End Sub |
private void SelChange(object sender, EventArgs e) { } void OnSelChange() { } void __fastcall SelChange(TObject *Sender) { } procedure SelChange(ASender: TObject; ); begin end; procedure SelChange(sender: System.Object; e: System.EventArgs); begin end; begin event SelChange() end event SelChange Private Sub SelChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelChange End Sub Private Sub SelChange() End Sub Private Sub SelChange() End Sub LPARAMETERS nop PROCEDURE OnSelChange(oEdit) RETURN |
<SCRIPT EVENT="SelChange()" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function SelChange() End Function </SCRIPT> Procedure OnComSelChange Forward Send OnComSelChange End_Procedure METHOD OCX_SelChange() CLASS MainDialog RETURN NIL void onEvent_SelChange() { } function SelChange as v () end function function nativeObject_SelChange() return |
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