GrapeCity MultiRow Windows Forms Documentation
CellParsing Event


Occurs when a cell leaves edit mode if the cell value has been modified.
Syntax
<FeatureAttribute(Name="DataTranslation", Version="v5.0")>
<SRDescriptionAttribute("Occurs when a cell leaves edit mode if the cell value has been modified. ")>
<SRCategoryAttribute("Display")>
Public Event CellParsing As EventHandler(Of CellParsingEventArgs)
Dim instance As GcMultiRow
Dim handler As EventHandler(Of CellParsingEventArgs)
 
AddHandler instance.CellParsing, handler
[Feature(Name="DataTranslation", Version="v5.0")]
[SRDescription("Occurs when a cell leaves edit mode if the cell value has been modified. ")]
[SRCategory("Display")]
public event EventHandler<CellParsingEventArgs> CellParsing
Event Data

The event handler receives an argument of type CellParsingEventArgs containing data related to this event. The following CellParsingEventArgs properties provide information specific to this event.

PropertyDescription
CellIndexGets the cell index in its parent Section.  
CellNameGets the cell name.  
CellStyleGets or sets the style applied to the edited cell.  
DesiredType (Inherited from System.Windows.Forms.ConvertEventArgs)
ParsingAppliedGets or sets a value that indicates whether a cell's value has been successfully parsed.  
RowIndexGets the index of the owner Row that the event occurs for.  
ScopeGets the cell area that the event occurs for.  
SectionIndexGets the index of the owner Section that the event occurs for.  
Value (Inherited from System.Windows.Forms.ConvertEventArgs)
Remarks

By default, the GcMultiRow control attempts to convert a user specified value displayed in a cell to an actual underlying cell value of the type specified by the cell ValueType property. This conversion uses the formatting properties of the cell style returned by the cell InheritedStyle property.

If the standard conversion is not adequate, handle the CellParsing event to provide custom value conversion to the required type.

Users can enter edit mode using the method specified by the EditMode property. They can leave edit mode, and commit any changes to a cell, by moving to another cell or by pressing Enter. Pressing Esc will revert any changes to the value before it was committed, and the CellParsing event will not occur. The CellParsing event occurs only if the cell value has actually been modified, even if the final value is the same as the original value. It also occurs when the CommitEdit method is called.

When you handle the CellParsing event, you can convert the value yourself or you can customize the default conversion.You can let the default type converters parse the value, but modify the NullValue, DataSourceNullValue, and FormatProvider properties of the object returned by the CellParsingEventArgs.CellStyle property. The cell style is initialized using the cell InheritedStyle property.

When you convert the value yourself, replace the initial, formatted value of the System.Windows.Forms.ConvertEventArgs.Value property with the converted value of the type specified by the cell ValueType property. To indicate that no further parsing is necessary, set the ParsingApplied property to true.

When the event handler completes, if the System.Windows.Forms.ConvertEventArgs.Value is a null reference (Nothing in Visual Basic) or is not of the correct type, or the ParsingApplied property is false, the value is parsed using default type converters. The default implementation of this method parses the value using the NullValue, DataSourceNullValue, and FormatProvider properties of the cell style passed in. If the value is not equal to NullValue, the value is parsed using the FormatProvider property and the type converters passed in.

To customize the conversion of a cell value into a formatted value for display, handle the CellFormatting event.

The event order when a user edits a cell's value and then clicks to another cell to apply the cell's value is as follows:

  1. User double-clicks a cell or presses a shortcut key or presses a character to enter edit mode.
  2. User inputs a value in the editing control or editing cell.
  3. User clicks another cell and the current cell prepares to move. User can then redirect the new cell position.
  4. If the target new cell's row index is different from the old current cell's row index, the RowLeave event is fired.
  5. Validates the cell's value.
  6. Converts the editing value type to a cell acceptable value type.
  7. The editing value is applied to the cell.
  8. Validates the whole row's value when the target new cell's row index is different from the old current cell's row index.
  9. The editing control or editing cell is uninstalled.
  10. Enters the new target cell.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GcMultiRow Class
GcMultiRow Members

 

 


Copyright © GrapeCity, inc. All rights reserved.