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?
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 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
Next
End With
End Sub
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.
Good idea. I will try this :)
Thanks ;)
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 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"
e.SummaryValue.SummarySettings.DisplayFormat = strDisplayFormat
Hello ,
I am glad to hear that you were able to solve your issue.
Thank you for using Infragistics Components.