Hello,
my problem : if a user, change value on grid1, i want to check if i can make the same modification for other lines in the same grid1. This is my code bellow.
The problem is, when i find other line to modify, i restart directly to the AfterCellUpdate events. And i can't change multiple lines.
Private Sub UltraGrid1_AfterCellUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles UltraGrid1.AfterCellUpdate'Je lance la routineRoutine_ultragrid1_01(e.Cell.Value)End Sub Private Sub Routine_ultragrid1_01(ByVal VALEUR As String) If UltraGrid1.ActiveRow.Appearance.BackColor = Color.Plum ThenIf MsgBox("Do you want to apply this parameter for all items in the same zone ?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then 'Alors j'aplique la meme valeur a toutes les lignes que je trouve.Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(0)Dim row As UltraGridRowDim Item_modif As String = UltraGrid1.ActiveRow.Cells(0).ValueDim cell_modif As String = UltraGrid1.ActiveCell.Column.Key.ToString For Each row In band.GetRowEnumerator(GridRowType.DataRow) If row.Cells("Cust Art Nb").Value = Item_modif Then row.Cells(cell_modif).Value = VALEUR'Here, instead of finish the loop, the program normaly go to the UltraGrid1_AfterCellUpdate event'And that's the problem !!! End IfNext rowEnd IfEnd IfEnd Sub
thank you for your help
It works !
thank you very much.
Thank you for your help. I have already try this option. But the problem is that the "event" is stronger than the boolean true or false.If i change de value of one cell in my grid, event if i put a boolean to check if my routine is started or not, the event "aftercellupdate" is running et the program exit from my routine.
Sorry, i'm french and it's a bit difficult to speak english.
A+
You can cancel the event Temporarily:
ultraGrid1.EventManager.SetEnabled(Infragistics.Win.UltraWinGrid.GridEventIds.AfterCellUpdate, false);// Do some updatesultraGrid1.EventManager.SetEnabled(Infragistics.Win.UltraWinGrid.GridEventIds.AfterCellUpdate, true);
The best way to work around this would be to keep a private variable that keeps track of whether or not you're in the method already, and if so bail out, i.e.:
Private inRoutine As Boolean = FalsePrivate Sub Routine_ultraGrid1_01(ByVal VALEUR As Strring) If(Me.inRoutine) Return Me.inRoutine = True Try ... Finally Me.inRoutine = False End TryEnd Sub
-Matt