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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

FormulaCell default null value

Thread ID:





20107 Oct 11,2004 12:23 AM UTC Oct 11,2004 09:41 PM UTC WinForms 2
Tags: GridControl
Asked On October 11, 2004 12:23 AM UTC

I have added an additional formula like so: cellModel = Me.grd.CellModels("FormulaCell") cellModel.Engine.AddFunction("Data", New GridFormulaEngine.LibraryFunction(AddressOf Evaluate_Data)) It all works fine atm, however when I return the value "" the grid is displaying "0". Is there a way I can change this behaviour so it displays what I return? I have tried returning Nothing but it still shows "0".

Administrator [Syncfusion]
Replied On October 11, 2004 05:19 AM UTC

The empty string is specially treated as a 0 by the formula engine. If you return any string other than the empty string, you would see that string in the cell. So, if you return " " instead of "", you would see a blank in the cell. This would be the simplest thing to do. If you really need to see the cell display the empty string, you can handle the DrawCellDisplayText event and specifiy what text you want to see in the cell there.
Private Sub gridControl1_DrawCellDisplayText(sender As Object, e As GridDrawCellDisplayTextEventArgs)
   If e.Style.Text.ToUpper().StartsWith("=DATA(") And e.Style.FormattedText = "0" Then
      e.DisplayText = ""
      e.Cancel = True
   End If
End Sub ''gridControl1_DrawCellDisplayText

Replied On October 11, 2004 09:41 PM UTC

hmmm, I figured I might have to use the " " string to trick it. Handling the DrawCellDisplayText event wont work as it doesnt seem to allow for valid cases of "0". I am happy to use " " as it doesnt seem to be causing any issues. Thanks.


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