We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I set the value of a cell

Thread ID:

Created:

Updated:

Platform:

Replies:

146431 Aug 3,2019 03:04 AM UTC Aug 5,2019 11:25 AM UTC WinForms 1
loading
Tags: PivotGridControl
George Busby
Asked On August 3, 2019 03:04 AM UTC

I am using the PivotGrid for data input. If a user does not enter a numeric value in the cell I want to clear out the value that was just entered. How can I set the value of the current cell?

Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 5, 2019 11:25 AM UTC

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 ObjectByVal newValue As ObjectByVal row1 As IntegerByVal col1 As IntegerByVal 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  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon