sfDataGrid caption summary

Hi  Manikanda,


Sorry but I have to ask you few more questions.


I manage to get summary results in Caption Row but not all is as I wanted.

This is what I got

Image_2131_1715330110178

Picture 1.

Ther is no Title. I put same code as in your example from internet sight (this code is similar to yours in example that you sent me), but still there is no title.

Obviously, I am doing something wrong, but I don't know what.

Without Caption Summery Row I got this


Image_9390_1715330608746

Picture 2.

I want to keep Group titles ("Sintetika 200 - Kupci - matična i zavisna pravna lica" from Picture 2) and Sums for Columns "Duguje", "Potrazuje" and "Saldo".


Another thing that confuses me is that the summery (in Picture 1) is without decimal places even that the values in the table are with decimal places. In the example from the internet sight Sums of currency values are shown with decimal places.


I also tried to use Creating Custom Renderer to change format of column sums (to add decimal places and to remove RSD - currency name) but when I added 

Public Class CustomGridCaptionSummaryRenderer
	Inherits GridCaptionSummaryCellRenderer
		Protected Overrides Sub OnRender...

and

Me.sfDataGrid1.CellRenderers.Remove("CaptionSummary")
Me.sfDataGrid1.CellRenderers.Add("CaptionSummary", New CustomGridCaptionSummaryRenderer())

a lot of errors come up.

Error BC30284 sub 'OnRender' cannot be declared 'Overrides' because it does not override a sub in a base class. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 453 Active

Error BC30002 Type 'RowColumnIndex' is not defined. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 453 Active

Error BC30518 Overload resolution failed because no accessible 'DrawString' can be called with these arguments:

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, x As Single, y As Single)': Value of type 'Rectangle' cannot be converted to 'Single'.

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, x As Single, y As Single)': Value of type 'StringFormat' cannot be converted to 'Single'.

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, point As PointF, format As StringFormat)': Value of type 'Rectangle' cannot be converted to 'PointF'.

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, layoutRectangle As RectangleF, format As StringFormat)': Value of type 'Rectangle' cannot be converted to 'RectangleF'. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 469 Active


I attached my form called "KF_KontniPlan" if that can help to solve this. 


I am writing code in vb.net (.NET Framework 4.8.1) so please if you sand me example can it be written in vb.net .Net Framework 4.8.1.


Once again thank you very much for previous answer.

Sincerely,

Sabian




Attachment: KF_KontniPlan_e6735b45.zip


27 Replies 1 reply marked as answer

SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 13, 2024 06:25 PM UTC

Hi Sabian Sirius, 

Regarding the issue where the title was not shown in the CaptionSummaryRow and an error was thrown when overriding the caption summary renderer, we used the code you shared. However, the title was displayed properly and there were no errors thrown when overriding the caption summary renderer. We have prepared a sample in VB; please find it attached. Please ensure that all the necessary namespaces are imported from this sample.


Regarding the decimal points not showing for the currency in the localization of Serbia, we are currently investigating this issue. We will provide further details on or before May 15, 2024.

We appreciate your patience until then.

Regards,

Sreemon Premkumar M.


Attachment: SfDataGrid_CaptionSummary_VB_83a42510.zip


SS Sabian Sirius May 14, 2024 07:06 AM UTC

Hi Sreemon Premkumar M.


Thank you for sending me example in vb.net for SfDataGrid Group View. I tried to change my code according to yours and added some namespaces that were not included but I didn't succeed. Even that code is the same I don't see title. I excluded render part of code (Form is KF_KontniPlan)


652        'Me.SfDataGrid1.CellRenderers.Remove("CaptionSummary")

653        'Me.SfDataGrid1.CellRenderers.Add("CaptionSummary", New CustomGridCaptionSummaryRenderer())


and 


685       Public Class CustomGridCaptionSummaryRenderer

.

705


If I include this code I get this Errors


Error BC30284 sub 'OnRender' cannot be declared 'Overrides' because it does not override a sub in a base class. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 694 Active

Error BC30518 Overload resolution failed because no accessible 'DrawString' can be called with these arguments:

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, x As Single, y As Single)': Value of type 'Rectangle' cannot be converted to 'Single'.

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, x As Single, y As Single)': Value of type 'StringFormat' cannot be converted to 'Single'.

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, point As PointF, format As StringFormat)': Value of type 'Rectangle' cannot be converted to 'PointF'.

    'Public Overloads Sub DrawString(s As String, font As Font, brush As Brush, layoutRectangle As RectangleF, format As StringFormat)': Value of type 'Rectangle' cannot be converted to 'RectangleF'. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 710 Active


I don't know what is the problem. 

I tried also to display data as Master Detail View (MDV) but also stuck in three level hiararhical view 

I made two videos for this. Maybe that will help.

I implement both of this Views in code (only changing variable named KF_VrstaKP  - "Group" for Group View and something else for MDV - Line Code number 72)


Maybe the problem is with getting data from database.


If it is OK with you, can you help me solve this problem. I can send you database and whole project if it is needed. The control (SfDataGrid) is fantastic (as it is the rest of your controls) and it just fits my needs.


Thank you in advance.


Regards,

Sabian


Attachment: SfDataGrid_Group_And_MDV_a837ee29.zip


SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 15, 2024 06:06 PM UTC

Hi Sabian Sirius, 

We have checked with the information you provided, but we are unable to replicate the reported issues in the GridCaptionSummaryCellRenderer and the master-details view with three grid view definitions. We have attached the tested sample for your reference.

Could you please specify which Syncfusion version you are using? Additionally, if possible, could you please share a sample that replicates the reported issue? This would be helpful for us to validate further and provide you with a solution as soon as possible.

Regarding the decimal point not showing, we believe that you must be using the localization culture-Serbia, and it is the default behavior.

Regards,

Sreemon Premkumar M.


Attachment: SfDataGrid_CaptionSummary_VB_21320c1c.zip


SS Sabian Sirius May 16, 2024 12:07 PM UTC

Hi  Sreemon Premkumar M.


I analyzed your example and because I didn't succeed to get what I want I am sending you the hole project. I wrote in MS Word text where I tried to explain whole problem.

Because the file is to big I cut it in three parts and will send you one by one.

Regards

Sabian


Attachment: SfDataGrid__Sabian_3e14ce7a.zip


SS Sabian Sirius May 16, 2024 12:09 PM UTC

Names of the Parts are 

SfDataGrid - Sabian.zip

SfDataGrid - Sabian.z01

SfDataGrid - Sabian.z02


Part 2 


Attachment: SfDataGrid__Sabian.z01_76289e30.zip


SS Sabian Sirius May 16, 2024 12:09 PM UTC



SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 17, 2024 05:08 PM UTC

Hi Sabian Sirius, 

Thanks for the update and the sample you shared.

We are currently validating the sample. We need some time to validate it and will provide you with further details on or before May 21, 2024.

We appreciate your patience until then.

Regards,

Sreemon Premkumar M.



SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 20, 2024 08:23 PM UTC

Hi Sabian Sirius, 

We have tried to attach the MDF file you have shared in the SSMS. but it throws and error that the "MDF file is not a primary file". We have tried to resolve this issue by taking the full control to the MDF file. but the issue was not resolved. If possible, could you please provide the backup file for the databases you have shared to resolve these types of errors? It will help us to launch the sample and validate the reported issue. 

Error:

Regards,
Sreemon Premkumar M.



SS Sabian Sirius May 21, 2024 10:56 AM UTC

Hi  Sreemon Premkumar M.


While I was waiting for your answer, I analyzed my database. Because I couldn't get Master Detail View I thought that maybe something is wrong with my database (Views, Tables). So I started to recreate database. As soon as I finish it, I will sand you Backup.

Regarding Grouping View in SfDataGrid, I also noticed in your example for Winforms controls (Syncfusion Essential Studio Control Panel 25.1.35) that Custom Summary Row on my computer is showing same thing as in my project. 

Image_6848_1716288422959

Sums of columns in Group row are left aligned, has currency symbol (RSD) after value and there are no decimal places even that the value in column has decimal numbers.

Here are settings on my computer


Image_2667_1716288768689


As I have written I didn't succeed to change this in my code.

Once again thank you for your support and quick answers. I am sending you database soon.


Best Regards

Sabian




SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 22, 2024 05:18 PM UTC

Hi Sabian Sirius, 

Thanks for the update.

The reason the currency symbol in the caption summary appears after the value and without decimal places is due to the culture (Serbian) set in your computer's system settings. We were able to replicate the same behavior on our end when setting the culture to Serbian using the code snippet below. This is the default behavior when setting the Serbian culture, and we haven't done anything specific for this culture. Please refer to the image below.

Code snippet:

System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("sr-RS")

System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("sr-RS")


Serbian culture image:


In the image below, you can see that when the culture is set to English (United States), the currency symbol is positioned before the value and includes decimal places.



Regarding the alignment of the caption summary row, you can set the alignment of the caption summary row by setting SfDataGrid.Style.CaptionSummaryRowStyle.HorizontalAlignment to Right. Before setting the alignment of the caption summary row, ensure that SfDataGrid.Style.CaptionSummaryRowStyle.TextMargin is set to 0. By default, it has a value of (12,0,12,0). Please find the code snippet below.

Code snippet:

this.sfDataGrid.Style.CaptionSummaryRowStyle.TextMargins = new Padding(0, 0, 0, 0);

this.sfDataGrid.Style.CaptionSummaryRowStyle.HorizontalAlignment = HorizontalAlignment.Right;


Output:

Regards,

Sreemon Premkumar M.



SS Sabian Sirius May 23, 2024 03:24 PM UTC

Hi  Sreemon Premkumar M.


Thank you for your answer. It was very helpful to me.


I am sending you databases backups. There are two databases (BasicDB and K_FinansijskoDB).

BasicDB is used to generate menus in the docking manager.

K_FinansijskoDB is used for generating data for SfDataGrid in form "KF_KontniPlan.vb"


I almost reach what I wanted to get. I also added document "SfDataGrid - CaptionSummaryRow - 23.05.2024.docx" where I explained what I have succeeded to do. Also, I have few questions about some settings to have better look of SfDataGrid.

At the end of the document, I draw how I would like to display data in SfDataGrid.

If anything else is needed I will send you.

Thank you once again.


Regards 

Sabian





Attachment: Answer_2024.05.23_c5ce17bb.zip


SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 24, 2024 05:00 PM UTC

Hi Sabian Sirius, 

Thanks for sharing the backup file and the information provided. 

We have reviewed the document you have shared. We need some time to check this requirement and we will provide you further details on or before May 28, 2024. 

We appreciate your patience until then.

Regards,

Sreemon Premkumar M.



SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 28, 2024 06:35 PM UTC

Hi Sabian Sirius,

Query 1: Can Title be left alignment and sums (columns “Duguje”, “Potrazuje” and “Saldo”) stayed right alignment?

Your requirement to align the caption summary title to the left and other caption summary column values to the right can be achieved by setting the CaptionSummaryRowStyle.HorizontalAlignment to right and setting the Style.HorizontalAlignment to left by checking whether the column has the title, by overriding the GridCaptionSummaryCellRenderer. Please find the code snippet below.

Code snippet:

Me.SfDataGrid1.Style.CaptionSummaryRowStyle.TextMargins = New Padding(0, 0, 0, 0)

Me.SfDataGrid1.Style.CaptionSummaryRowStyle.HorizontalAlignment = HorizontalAlignment.Right

//Overriding the GridCaptionSummaryCellRenderer to change the alignment.

Public Class CustomGridCaptionSummaryRenderer

    Inherits GridCaptionSummaryCellRenderer


    Protected Overrides Sub OnRender(paint As Graphics, cellRect As Rectangle, cellValue As String, style As CellStyleInfo, column As DataColumnBase, rowColumnIndex As RowColumnIndex)

        'OrderID is the first column.

        'This sets the title of the caption summary to Left.

        If column.GridColumn.MappingName = "OrderID" Then

            style.HorizontalAlignment = HorizontalAlignment.Left

        End If

        MyBase.OnRender(paint, cellRect, cellValue, style, column, rowColumnIndex)

    End Sub

End Class

We understand that you are facing some errors when overriding the GridCaptionSummaryCellRenderer, but it is the correct way to set the title to the left and the other caption summary columns to the right.

Please let us know if you are still facing the same errors when overriding the GridCaptionSummaryCellRenderer.

Query 2: Can these titles be displayed without those four columns (“Godina”, “Klasa”, “Grupa” and “Sintetika”) set to visible? I think you somehow did it in your example.

We were able to replicate the issue by hiding the columns in a simple sample. In the previously shared sample, we set the visibility to false for the last three columns, so that it does not affect the showing of the caption summary title. We are currently investigating this behavior at the source level. We need some time to validate it and will update you with further details on or before May 30, 2024. We appreciate your patience until then.

Query 3: how can I read data from Title of the CaptionSummaryRow when I click on it?

Your requirement to read or get the value of the caption summary when clicking on the caption summary can be achieved by using the SummaryCreator.GetSummaryDisplayTextForRow() method inside the SfDataGrid.CellClick event. Please find the code snippet below.

Code snippet:

 Private Sub sfDataGrid1_CellClick(sender As Object, e As CellClickEventArgs)

     Dim summaryRowInfo As Group = TryCast(e.DataRow.RowData, Group)

     If summaryRowInfo IsNot Nothing Then

         If summaryRowInfo.SummaryDetails IsNot Nothing Then

             Dim value = SummaryCreator.GetSummaryDisplayTextForRow(summaryRowInfo.SummaryDetails, Me.SfDataGrid1.View)

             MessageBox.Show(value, "Caption Value")

         End If

     End If

 End Sub


Output:


Regards,
Sreemon Premkumar M.


Attachment: SfDataGrid_CaptionSummary_VB_5841b4a9.zip


SS Sabian Sirius May 31, 2024 09:12 AM UTC


Hi Sreemon Premkumar M.


Query 1: Can Title be left alignment and sums (columns “Duguje”, “Potrazuje” and “Saldo”) stayed right alignment?


Still cannot solve problem with "Protected Overrides Sub OnRender" 

I got this error.

Error BC30284 sub 'OnRender' cannot be declared 'Overrides' because it does not override a sub in a base class. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 638 Active


But now I have new one 

Error BC30311 Value of type 'RowColumnIndex' cannot be converted to 'RowColumnIndex'. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 644 Active


I opened new Project and there were no problem with Overrides but in this particularly project it has.

 

Query 2: Can these titles be displayed without those four columns (“Godina”, “Klasa”, “Grupa” and “Sintetika”) set to visible? I think you somehow did it in your example.


Still cannot see title. I copied your solution in my code but it doesn't work.

Maby something is wrong with converting data from my database to List. 

I'll keep trying.


Query 3: how can I read data from Title of the CaptionSummaryRow when I click on it?


Works great. I manage to read value. Thank you.



It is interesting that your example is working fine. Shows everything. But in my project, something is wrong.

After a while same error (connected with "Protected Overrides Sub OnRender") showed up in your example. I didn't add or changed anything in code, only add packages. 

I will investigate more.


I will sand new information if I find reasons for errors or after a while if I don't find solution.  


Regards,
Sabian



SP Sreemon Premkumar Muthukrishnan Syncfusion Team May 31, 2024 06:21 PM UTC

Hi Sabian Sirius,

Thanks for the update. We will wait to hear the reason for the error from you.

Regarding Query 2, we haven't provided any solution in that sample because some columns where the titles are meant to be shown are not visible. As a result, the titles are not properly displayed in the caption row. We are still checking at the source level to find any possible workaround to show the titles even when the columns are not visible. As we mentioned earlier, we will update you with further details on June 03, 2024.

We appreciate your patience until then.

Regards,

Sreemon Premkumar M.



SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 3, 2024 06:14 PM UTC

Hi Sabian Sirius,

Sorry for the inconvenience caused. When the TitleColumnCount and the first hidden column count are equal, we can't render the title in the caption summary row.

We are currently investigating whether to show the title in the caption summary row when the hidden column count is less than the TitleColumnCount. We need some time and will update you with further details on June 05, 2024.

We appreciate your patience until then.

Regards,

Sreemon Premkumar M.



SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 5, 2024 04:40 PM UTC

Hi Sabian Sirius,

Regarding the query 2: Can these titles be displayed without those four columns (“Godina”, “Klasa”, “Grupa” and “Sintetika”) set to visible? I think you somehow did it in your example

As we mentioned earlier, when the title column count is equal to the hidden column count, or when the hidden column count is less than the title column count, the title will not be shown because some of the columns meant to display the title are hidden.

There is no possible customization at the sample level to display the title in the remaining columns, as it requires more internal checks. Therefore, this should be considered as a feature request.

If you have any concerns or questions regarding this, please let us know.

Regards,
Sreemon Premkumar M.


Marked as answer

SS Sabian Sirius June 7, 2024 06:09 AM UTC

Hi Sreemon Premkumar M.


Regarding the query 2: Can these titles be displayed without those four columns (“Godina”, “Klasa”, “Grupa” and “Sintetika”) set to visible? I think you somehow did it in your example.


Finaly, I got titles in Caption row as I wanted. I rearrange columns in database and in code and Titles are exact as they should be except that I have still problem with  "Protected Overrides Sub OnRender" procedure.

I got these two errors

Error BC30284 sub 'OnRender' cannot be declared 'Overrides' because it does not override a sub in a base class. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 638 Active

and

Error BC30311 Value of type 'RowColumnIndex' cannot be converted to 'RowColumnIndex'. EM_2024_1 D:\VB Net\VB Net Projects\Aktuelno\EM-2024_1\EM-2024_1\KF_KontniPlan.vb 644 Active


In the beginning there was only one error now there are two of them. I think that is something wrong with my code or I did something that cause these errors.

If you have any idea I would appreciate.

Any way thanks for your help.


With respect,

Sabian



SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 10, 2024 12:44 PM UTC

Hi Sabian Sirius, 

As we said earlier, we are unable to replicate this issue on our end. In your previous update, you mentioned that adding certain packages causes this error in the sample we shared. If possible, could you please modify the sample on your side by adding those packages and share it with us? This will help us replicate the issue and validate it further to provide a solution as soon as possible.

Regards,

Sreemon Premkumar M.


Attachment: SfDataGrid_CaptionSummary_VB_5841b4a9_72b1585f.zip


SS Sabian Sirius June 11, 2024 11:57 AM UTC


Hi Sreemon Premkumar M.,


As you suggested I made some changes in code. 

First, I added these imports


Imports System.Collections.ObjectModel

Imports Syncfusion.WinForms.GridCommon.ScrollAxis

Imports System.ComponentModel

Imports Syncfusion.Windows.Forms

Imports Syncfusion.WinForms.DataGrid.Interactivity


that were not in my form (KF_KontniPlan.vb)


There was still marked error on 

Protected Overrides Sub OnRender(paint As Graphics, cellRect As Rectangle, cellValue As String, style As CellStyleInfo, column As DataColumnBase, rowColumnIndex As RowColumnIndex)


OnRender was marked and RowColumnIndex was marked.


Then Visual Studio suggested to change code in this

Protected Overrides Sub OnRender(paint As Graphics, cellRect As Rectangle, cellValue As String, style As CellStyleInfo, column As DataColumnBase, rowColumnIndex As Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex)


it added this in line 

Syncfusion.WinForms.GridCommon.ScrollAxis


 so, I got  Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex and there were no marked error.


I started program and this popup on screen


Image_6956_1718106233274


This is within 


C:\Users\Peko\AppData\Local\Temp\.vsdbgsrc\c724e65a8f7b77b140b8aed99aab2dd855c16aea23ce6a697770896aaa480b05\GridSummaryCellRendererBase.cs


This is part of code


public class GridSummaryCellRendererBase : GridCellRendererBase

{

protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)

{

/* This line was marked yellow* - I underline it/

int num = base.TableControl.DataGrid.GroupColumnDescriptions.Count + Convert.ToInt32(base.TableControl.DataGrid.ShowRowHeader) + ((base.TableControl.DataGrid.DetailsViewDefinitions != null) ? base.TableControl.DataGrid.DetailsViewDefinitions.Count : 0) + Convert.ToInt16(base.TableControl.DataGrid.ShowPreviewRow);

DrawingHelper.PaintCellBackground(paint, cellRect, style, canApplyInterior: true);

if (string.IsNullOrEmpty(cellValue))

{

return;

}


I will also try to analyze database. If there is a problem.


Best regards

Sabian 



SG Santhosh Govindasamy Syncfusion Team June 12, 2024 04:58 PM UTC

Hi Sabian Sirius, 

We are glad to know that your error has been resolved by importing the Syncfusion-related namespaces. As we checked, we didn't face any errors as you mentioned.

Kindly share the following details:

1. What actions did you perform to get the null reference exception? Please share the details.

2. Kindly share the exception-related call stack (stack trace) details.




SS Sabian Sirius June 13, 2024 10:56 AM UTC

Hi  Santhosh Govindasamy,


I will try to explain what I did step by step.

  1.  My application was running Ok as it is shown in video that I am sending you as attachment ("SfDataGrid Without Ovrrides OnRender.mp4")
  2. I wanted to align Titles of CaptionSummaryRow to the Left and the sums in columns ("Duguje", "Potrazuje" and "Saldo") to stay aligned on the Right.
  3. As suggested, I added Sub Protected Overrides Sub OnRender (and two more lines to call this sub) in my code but I got two Errors (Visual Studio marked Error on "OnRender" and on "RowColumnIndex)
  4. I asked for help once more.
  5. After I got answer about the Errors in Sub

Protected Overrides Sub OnRender(paint As Graphics, cellRect As Rectangle, cellValue As String, style As CellStyleInfo, column As DataColumnBase, rowColumnIndex As RowColumnIndex)


I added these imports

Imports System.Collections.ObjectModel

Imports Syncfusion.WinForms.GridCommon.ScrollAxis

Imports System.ComponentModel

Imports Syncfusion.Windows.Forms

Imports Syncfusion.WinForms.DataGrid.Interactivity


that were not in my form (KF_KontniPlan.vb).


But there was still marked error as previous.

OnRender was marked and RowColumnIndex was marked.


Then Visual Studio suggested to change code in this line

Protected Overrides Sub OnRender(paint As Graphics, cellRect As Rectangle, cellValue As String, style As CellStyleInfo, column As DataColumnBase, rowColumnIndex As RowColumnIndex)

by adding 

Syncfusion.WinForms.GridCommon.ScrollAxis in front of ​ RowColumnIndex


 so, I accept suggestion and got this 


Protected Overrides Sub OnRender(paint As Graphics, cellRect As Rectangle, cellValue As String, style As CellStyleInfo, column As DataColumnBase, rowColumnIndex As Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex)


and after that there were no marked errors.


6. I started application and "System.NullReferenceException" popup on screen. (I am sending you video "SfDataGrid With Ovrrides OnRender.mp4" where you can see it)


This is all I did. I wasn't changing my database or added some other lines of code.


I am sending you also a picture of Call Stack (Call Stack.png) and a text file with content of Call Stack ("Call Stack.txt")


I hope this is Ok. If anything else is needed I will send you.


Regards 

Sabian






Attachment: SFDataGrid__GroupView_2fdb4ecf.zip


SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 14, 2024 06:03 PM UTC

Hi Sabian Sirius,

We have checked the video output and modified our sample with the code changes you provided to use the full namespace for the RowColumnIndex, as well as the modifications for the SfDataGrid in the KF_KontniPlan VB file that you shared earlier. However, we are unable to replicate the exception on our end. Additionally, we have reviewed the call stack you shared, but we suspect that another implementation or customization is causing the exception when overriding the caption summary renderer.

We have attached the tested sample with a video reference. Could you please review the sample and modify it with any implementation that we might be missing?. Also, provide the Syncfusion version you have using. This will help us replicate the issue and validate it further.

Regards,

Sreemon Premkumar M.


Attachment: SfDataGrid_CaptionSummary_VB_b2576d73.zip


SS Sabian Sirius June 17, 2024 06:24 AM UTC

Hi Sreemon Premkumar M.,


I tried to find what is causing problem in my code but I didn't succeed.

Still get This error


An unhandled exception of type 'System.NullReferenceException' occurred in Syncfusion.SfDataGrid.WinForms.dll

Object reference not set to an instance of an object.

Extracted embedded document "Syncfusion.WinForms.DataGrid.Renderers\GridSummaryCellRendererBase.cs" to "C:\Users\Peko\AppData\Local\Temp\.vsdbgsrc\c724e65a8f7b77b140b8aed99aab2dd855c16aea23ce6a697770896aaa480b05\GridSummaryCellRendererBase.cs"

The program '[7720] EM_2024_1.exe' has exited with code 4294967295 (0xffffffff).


I also created another sample application that didn't show error. I will try to find what was the reason in this code and inform you if I found it.


Best regards,

Sabian



SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 18, 2024 04:10 PM UTC

Hi Sabian Sirius, 

Thanks for the update, we will wait until we hear from you

Regards,

Sreemon Premkumar M.



SS Sabian Sirius July 16, 2024 06:57 AM UTC

Hi  Sreemon Premkumar M.,


Here is an update for CaptionSummaryRow.


I reinstalled Visual Studio and Syncfusion components, but nothing changed at first.

I added some new code for connecting MS SQL Server to application (checking and adding records to database). I started application few times to check does it work OK. Adding data and checking records was OK. After a while I noticed this warning in Visual Studio

Severity Code Description Project File Line Suppression State

Warning The explicit binding redirect on "Syncfusion.Calculate.Base, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" conflicts with an autogenerated binding redirect. Consider removing it from the application configuration file or disabling autogenerated binding redirects. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-26.1462.41.0" newVersion="26.1462.41.0" xmlns="urn:schemas-microsoft-com:asm.v1" />". EM_2024_1

Warning The explicit binding redirect on "Syncfusion.Licensing, Culture=neutral, PublicKeyToken=632609b4d040f6b4" conflicts with an autogenerated binding redirect. Consider removing it from the application configuration file or disabling autogenerated binding redirects. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-26.1462.41.0" newVersion="26.1462.41.0" xmlns="urn:schemas-microsoft-com:asm.v1" />". EM_2024_1

I started application once more. Application started with no problem or error. I opened form with SfDataGrid it worked as previous did (I didn't call Overrides subroutine). Then I tried to call subroutine to Override alignment.

I was shocked, everything worked just fine as I wanted at the beginning. 

Caption titles to be left alignment and sums to be right alignment.

I don't know what has happened, but it works.


Image_6488_1721112985459


I want to thank you once again for your effort and spent time to help me solve this problem.


Best regards,

Sabian



SP Sreemon Premkumar Muthukrishnan Syncfusion Team July 17, 2024 03:16 PM UTC

Hi Sabian Sirius,

Thanks for the update. We are glad that the issue is resolved on your end. If you have any other queries, please let us know.

Regards,

Sreemon Premkumar M.


Loader.
Up arrow icon