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 to change a column as a result of changing another column

Thread ID:

Created:

Updated:

Platform:

Replies:

146946 Aug 26,2019 03:36 PM UTC Sep 4,2019 05:04 AM UTC WinForms 3
loading
Tags: GridGroupingControl
Ricardo Abranches
Asked On August 27, 2019 09:40 AM UTC

In a grid, I need to manually recalculate two other columns after manually changing one column.
how can you do it in vb.net


my code is 

 Private Sub Grelha_TableControlCurrentCellValidated(sender As Object, e As GridTableControlEventArgs) Handles Grelha.TableControlCurrentCellValidated
        Dim dComissaoEmpresa As Double = 0

        Select Case ccTipo
            Case tipo.Agentes


                ' CELULA ONDE ESTOU
                Dim currentCell As GridCurrentCell = Me.Grelha.TableControl.CurrentCell
                Dim tableCellStyle As GridTableCellStyleInfo = e.TableControl.GetTableViewStyleInfo(currentCell.RowIndex, currentCell.ColIndex)

                If Not IsNothing(tableCellStyle.TableCellIdentity.Column) Then
                    Dim r As Record = Grelha.Table.CurrentRecord
                    Select Case tableCellStyle.TableCellIdentity.Column.Name
                        Case "Perc." ' - nome da coluna em que estou

                            Dim dPerc As Double = r.GetValue("Perc.") -> that's my problem. it brings the old value not the value that i put in the column


                            dComissaoEmpresa = r.GetValue("Com. Empresa")
                            r.SetValue("Vl. Comissão", dComissaoEmpresa * dPerc / 100)
                            r.SetValue("Vl.Restante", dComissaoEmpresa - (dComissaoEmpresa * dPerc / 100))
                        Case "Vl. Comissão" ' 
                        Case "Vl.Restante"
                        Case Else
                    End Select

                End If
            Case Else
        End Select
    End Sub
End Class

Arulpriya Ramalingam [Syncfusion]
Replied On August 27, 2019 12:56 PM UTC

Hi Ricardo, 
 
Thanks for using Syncfusion products. 
 
In order to perform some computation in a column based on other columns values, the ExpressionFields can be added to the GridTableDescriptor. We already documented the details to use ExpressionFields in GridGroupingControl. Please make use of the below UG link. 
 
 
Please revert us with simple screenshot of your requirement, if we misunderstood your scenario. 
 
Regards, 
Arulpriya 


Ricardo Abranches
Replied On September 3, 2019 02:10 PM UTC

Hello and thanks. The link you send explains what i need.
Thanks , and keep on the good work.

Arulpriya Ramalingam [Syncfusion]
Replied On September 4, 2019 05:04 AM UTC

Hi Ricardo, 
 
Thanks for the update. 
 
We are glad to know that the reported use case is resolved at your end and we are happy to assist you. 
 
Arulpriya 


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