Hello,
I tried setting customized strings using these:
Also tried to set for #Calculating but it's not working... I have customized strings for other things and they all work except this... I need to set this to custom Summary I made.
Could it have something to do with the fact that it's not working in Summary?
It's urgent please!! :)
Can you post the code where you are assigning these strings?
Or even better, can you post a small sample project demonstrating what you are doing so we can check it out?
many thanks for the quick reply. I figured it out: I was not assigning the variables to the correct ResourceCustomizer.
My only problem now is the message "NaN (it's not a number)". I can't figure out how to replace this.
Any ideas?
A similar issue about NaN (it’s not a number ) was discussed on the following forum thread:
http://community.infragistics.com/forums/p/13406/49635.aspx
Please pay attention on the second response of Mike Saltzman.
Please let me know if you have any further questions.
Thanks for the reply.
Mike talked about using a CreationFilter and changing the TextUIElement directly.
Can you give me an example of how to do this please?
Hi,
Here's a thread where I posted some sample code that changes the text in a cell using a CreationFilter.
Wingrid with calc manager rounding - Infragistics Community
You will, of course, want to change it around so that it looks for the correct column in your grid and also checks for a value of double.NaN.
Let me know if you have any trouble getting it working.
Many thanks Mike. Just a question: this work with summaries? Because that's what I need...
Hello ,
I am glad to hear that you were able to solve your issue.
Thank you for using Infragistics Components.
Just tested and it works like a charm...
Doing it on the SummaryValueChanged of the grid is way more efficient. Thanks for the tip ;)
The code looks like this now:
Private Sub grdWin_SummaryValueChanged(sender As Object, e As Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs) Handles grdWin.SummaryValueChanged Dim dbl As Double = 0 Dim strDisplayFormat As String = String.Empty If Not e.SummaryValue.Value Is Nothing AndAlso _ Not e.SummaryValue.Value Is DBNull.Value Then If Double.TryParse(e.SummaryValue.Value.ToString, dbl) Then strDisplayFormat= e.SummaryValue.SummarySettings.DisplayFormat If e.SummaryValue.Value.ToString.Contains("NaN") Then e.SummaryValue.SummarySettings.DisplayFormat = "N/A" Else e.SummaryValue.SummarySettings.DisplayFormat = strDisplayFormat End If End If End If End Sub
Dim dbl As Double = 0
Dim strDisplayFormat As String = String.Empty
If Not e.SummaryValue.Value Is Nothing AndAlso _
Not e.SummaryValue.Value Is DBNull.Value Then
If Double.TryParse(e.SummaryValue.Value.ToString, dbl) Then
strDisplayFormat= e.SummaryValue.SummarySettings.DisplayFormat
If e.SummaryValue.Value.ToString.Contains("NaN") Then
e.SummaryValue.SummarySettings.DisplayFormat = "N/A"
Else
e.SummaryValue.SummarySettings.DisplayFormat = strDisplayFormat
End If
End Sub
Good idea. I will try this :)
Thanks ;)
No, the code I posted is for cell. For Summaries, it would have to be modified.
Your solution is a good one, and probably a lot simpler than mine. But looping through every SummaryValue is probably not the most efficient way to go.
It would be more efficient and simplify the code if you used the SummaryValueChanged event (of the grid) instead of CalculationsCompleted.
I found an easier way to replace the "NaN" string in summary: This is my code and it works like a charm!!!.
If a number is a Double then it checks for the "NaN" value.. if it is replaces with "N/A" and if not puts the original Display Format.
Hope it helps someone!!!
Private Sub CalcManager1_CalculationsCompleted(sender As Object, e As System.EventArgs) Handles objCalcManager.CalculationsCompleted Dim i As Integer = 0 Dim dbl As Double = 0 Dim strDisplayFormatAs String = String.Empty With grdWin For i = 0 To .DisplayLayout.Bands(0).Summaries.Count - 1 If Not .Rows.SummaryValues(i).Value Is Nothing AndAlso _ Not .Rows.SummaryValues(i).Value Is DBNull.Value Then If Double.TryParse(.Rows.SummaryValues(i).Value.ToString, dbl) Then strDisplayFormat= .Rows.SummaryValues(i).SummarySettings.DisplayFormat If .Rows.SummaryValues(i).Value.ToString.Contains("NaN") Then .Rows.SummaryValues(i).SummarySettings.DisplayFormat = "N/A" Else .Rows.SummaryValues(i).SummarySettings.DisplayFormat = strDisplayFormat End If End If End If Next End With End Sub
Dim i As Integer = 0
Dim strDisplayFormatAs String = String.Empty
With grdWin
For i = 0 To .DisplayLayout.Bands(0).Summaries.Count - 1
If Not .Rows.SummaryValues(i).Value Is Nothing AndAlso _
Not .Rows.SummaryValues(i).Value Is DBNull.Value Then
If Double.TryParse(.Rows.SummaryValues(i).Value.ToString, dbl) Then
strDisplayFormat= .Rows.SummaryValues(i).SummarySettings.DisplayFormat
If .Rows.SummaryValues(i).Value.ToString.Contains("NaN") Then
.Rows.SummaryValues(i).SummarySettings.DisplayFormat = "N/A"
.Rows.SummaryValues(i).SummarySettings.DisplayFormat = strDisplayFormat
Next
End With