Home › Forums › WinForms controls › Xceed Grid for WinForms › Cell value changed event
-
AuthorPosts
-
#14723 |
I want to validate values entered in the cells. As I tried by following codes, i could not get it done.
Private Sub fillGrid
grdProduct.DataSource = prodDs.Tables(0)
Dim cell As Xceed.Grid.DataCell
For Each cell In grdProduct.DataRowTemplate.Cells
AddHandler cell.ValueChanged, AddressOf cell_ValueChanged
Next cell
End SubPrivate Sub cell_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox(“changed”)
End SubAny suggestions why above code not raising the event ??
Imported from legacy forums. Posted by PETE (had 3992 views)
You need to do it on the CellEditorManager, and the implementation will depend on the editor that is used for the cell / column.
<i>
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
</i>
//do it before filling the data to the gird <i>
AddHandler GridControl2.Columns( 1 ).CellEditorManager.ActivatingControl, AddressOf CellEditorManager_ActivatingControl
AddHandler GridControl2.Columns( 1 ).CellEditorManager.DeactivatingControl, AddressOf CellEditorManager_DeactivatingControlEnd Sub
Private Sub CellEditorManager_ActivatingControl( ByVal sender As Object, ByVal e As Xceed.Grid.Editors.CellEditorEventArgs )
</i>
//The cast must correspond to the editor set as the CellEditorManager, by default a WinTextBox for string columns<i>
Dim editor as Xceed.Editors.WinTextBox = CType( e.Control, Xceed.Editors.WinTextBox)
AddHandler editor.TextBoxArea.KeyDown, AddressOf editor_KeyDownEnd Sub
Private Sub CellEditorManager_DeactivatingControl( ByVal sender As Object, ByVal e As Xceed.Grid.Editors.CellEditorEventArgs )
Dim editor as Xceed.Editors.WinTextBox = CType( e.Control, Xceed.Editors.WinTextBox)
RemoveHandler editor.TextBoxArea.KeyDown, AddressOf editor_KeyDownEnd Sub
Private sub editor_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs )
</i>
‘Your keydown event code here
<i>
End Sub
</i>Imported from legacy forums. Posted by André (had 299 views)
That works fine. I can play around more than what i expected.
Is it possible to get the original value of cell (wintextbox), after editied ?
Imported from legacy forums. Posted by PETE (had 503 views)
You can revert back to the cell’s original value as long as the EndEdit has not committed the changes to the cell, by using the EndingEdit event. You can look at the following topics from the online help documentation, to have a better idea on cell validation, and the different options you have :
http://doc.xceedsoft.com/products/gridNET/doc/sources/validating.htm
http://doc.xceedsoft.com/products/gridNET/doc/sources/validation_process.htmThere is also a sample application that demonstrate how to validate the content of a grid:
Master directory:
[Program Files]\Xceed Components\Xceed Grid for .NET [version]\Samples\VS.NET 2003
or
[Program Files]\Xceed Components\Xceed Grid for .NET [version]\Samples\VS.NET 2005C#: \CSharp\Validating\ValidatingCS.csproj
VB.NET: \Visual Basic .NET\Validating\ValidatingVB.vbprojImported from legacy forums. Posted by André (had 4256 views)
-
AuthorPosts
- You must be logged in to reply to this topic.