property Editor.Value as Variant
Retrieves or sets the field's value.

   Variant A Variant expression that specifies the editor's value.  
Use the Value property to get the editor's value. Use the Caption property to get the editor's caption. The Caption property of the editor may be different than the Value property like follows. For instance, if we have a DropDownListType editor, the Caption property gets the caption of the item being selected, and the Value property gets a long expression that identifies the value of the item. The Label property gets the editor's label. Use the FindItem property to find an item based on its value. The Change event is fired when the user alters the editor's content. Use the AddItem property to add predefined items to a drop down editor (DropDownType, DropDownListType, PickEditType, and CheckListType). Use the EditType property to change the type of the editor. Call the Refresh method to update the editor's value, if it depends on a predefined list of items ( drop down editors ). The Change event is called when the uses changes the value for an editor. If the control is bounded to a recordset ( DataSource property ), the value of the field is automatically updated in the recodset too.

The following VB sample prints the label, caption and the value of the editor from the cursor:

Private Sub Record1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim e As EXRECORDLibCtl.Editor
    Set e = Record1.EditorFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY)
    If Not e Is Nothing Then
        Debug.Print "Label: " & e.Label & " Caption: """ & e.Caption & """ Value: " & e.Value
    End If
End Sub

The following VC sample prints the label, caption and the value of the editor from the cursor:

void OnMouseMoveRecord1(short Button, short Shift, long X, long Y) 
	CEditor editor = m_record.GetEditorFromPoint( X, Y );
	if ( editor.m_lpDispatch != NULL )
		TCHAR szOutput[1024];
		wsprintf( szOutput, "Label: %s Caption: \"%s\" Value: %s\n", (LPCTSTR)editor.GetLabel(), (LPCTSTR)editor.GetCaption(), (LPCTSTR)V2S( &editor.GetValue() ) );
		OutputDebugString( szOutput );

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.