Hi George,
We have analyzed the reported query “How to restrict the string values while editing the cell value”. By default, we have converted the edited cell value into ‘Double’ type. If you have edited the cell value by using numeric string, the cell value automatically convert into zero using pivot editing manager). Suppose if you want to customize the entered string value, you should do the following changes in your application (applicable for defining the custom editing manager).
Please refer the following code sample,
# Form1.vb
Public Class CustomEditingManager
Inherits PivotEditingManager
Public Sub New(ByVal pg As PivotGridControlBase)
MyBase.New(pg)
End Sub
Protected Overrides Sub ChangeValue(ByVal oldValue As Object, ByVal newValue As Object, ByVal row1 As Integer, ByVal col1 As Integer, ByVal pi As PivotCellInfo)
If Not System.Text.RegularExpressions.Regex.IsMatch(newValue, "^\d+$") Then
newValue = 0
End If
'do the base change
MyBase.ChangeValue(oldValue, newValue, row1, col1, pi)
''mark all the adjusted cell contents
'pi.FormattedText &= "*"
End Sub
End Class |
If the above solution does not resolve your actual requirement could you please share the detailed description about your requirement along with screenshots, so that it could be helpful to provide the solution at the earliest.
Regards,
Subburaj Pandian V