event Change (Ed as Editor, NewValue as Variant)
Occurs when the user changes the editor's content.

 TypeDescription 
   Ed as Editor An Editor object whose value is changed.  
   NewValue as Variant A Variant expression that indicates the newly editor's value.   
The Change event notifies your application that the user changes the editor's value. Use the ButtonClick event to notify your application that the user clicks the editor's button. If the editor hosts an ActiveX control use the UserEditorOleEvent event to monitor the events inside the ActiveX object. If the control is bounded to a database using the DataSource property, the control automatically updates the database. If failed, the LastError property gets the description of the last error. The Change event is fired just before changing the Value property. The Value property specifies the value of the editor. The field's value depends on the type of the editor that's assigned to the field. For instance, if the field has assigned a DropDownListType editor, the Value property indicates a long expression that indicates the index of the predefined item being selected. Use the Caption property to retrieve the caption of the editor. Use the Label property to retrieve the label of the editor.

The following VB sample displays the editor's value as soon as the user changes the control's content:

Private Sub Record1_Change(ByVal Ed As EXRECORDLibCtl.IEditor, NewValue As Variant)
    Debug.Print Ed.Label & " = " & NewValue
End Sub 

The following VC sample displays the editor's value as soon as the user changes the control's content:

void OnChangeRecord1(LPDISPATCH Ed, VARIANT FAR* NewValue) 
{
	CEditor editor( Ed );
	editor.m_bAutoRelease = FALSE;

	TCHAR szOutput[1024];
	wsprintf( szOutput, "%s, = %s", (LPCTSTR)editor.GetLabel(), (LPCTSTR)V2S( NewValue ) );
	OutputDebugString( szOutput );
}

Send comments on this topic.
© 1999-2007 Exontrol Inc, Software. All rights reserved.