Free Support Forum - aspose.com

Detecting paste into a cell- CellKey

I am using grid desktop, latest version, I need to put cell’s original value into the comment for that cell when user changes a value. I have hooked the CellKeyPressed event, and I add the cell’s original value to the comments there 1st time a keypress is detected in the cell, but I also need to do the same if a value is pasted into a cell, but I don’t see how I can do that. CellDataChanged event does not give me cell value before the change so I can;t use that; is there anything I can do?

Hi,

Well, you may use Aspose.Cells.GridDesktop.CellEventArgs.Argument to get the previous value of the cell before inserting or pasting the new value. See the sample code, I have handled CellDataChanged event:

Private Sub GridDesktop1_CellDataChanged(ByVal sender As System.Object, ByVal e As Aspose.Cells.GridDesktop.CellEventArgs) Handles GridDesktop1.CellDataChanged

Dim value1 As Object = e.Argument
Dim message As String = “CellDataChanged event is raised.”
Message += " Previous cell data is " + value1 + “,”
MessageBox.Show(message)

'… Your code goes here


End Sub


Thank you.