Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145888 | Jul 12,2019 02:23 AM UTC | Jul 16,2019 12:12 PM UTC | WinForms | 4 |
![]() |
Tags: PivotGridControl |
# Form1.vb
Public Sub New() InitializeComponent()
PivotGridSettings()
AddHandler pivotGridControl1.TableControl.CurrentCellStartEditing, AddressOfMe.TableControl_CurrentCellStartEditing
AddHandler pivotGridControl1.TableControl.CurrentCellEditingComplete,AddressOf Me.TableControl_CurrentCellEditingComplete
End Sub
'Occurs while edting the cells
Private Sub TableControl_CurrentCellStartEditing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
'Write your code here.
End Sub
'Occurs after complete the editing.
Private Sub TableControl_CurrentCellEditingComplete(ByVal sender As Object,ByVal e As EventArgs)
'Write your code here.
End Sub
|
# Form1.vb
Private Sub TableControl_CurrentCellEditingComplete(ByVal sender As Object, ByVal e As EventArgs)
‘find the row and column index of edited cell.
Dim row As Integer = Me.pivotGridControl1.TableControl.CurrentCell.RowIndex - 1
Dim column As Integer = Me.pivotGridControl1.TableControl.CurrentCell.ColIndex – 1
‘find the first row header.
Dim rowheader As String = Me.pivotGridControl1.PivotEngine(row, 0).FormattedText
‘find the first column header.
Dim columnheader As String = Me.pivotGridControl1.PivotEngine(0, column).FormattedText
‘find the cell value after editing. Dim value As Integer = Convert.ToInt32(Me.pivotGridControl1.PivotEngine(row, column).FormattedText.ToString())
‘Updates the ItemSource with new value. For Each sales As ProductSales In productSalesData
If sales.Country = columnheader AndAlso sales.Date = rowheader Then
sales.Quantity = value
End If
Next
End Sub |
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.
This page will automatically be redirected to the sign-in page in 10 seconds.