Posted 6 December 2019, 1:21 pm EST
Hi,
It seems like the application freezes because of the code in the Selchange event. When first executed all goes well, but return to Form1 to view the data again in Form2, that part of the code seems to be stuck in a look because the Msgbox AA,BA,CC keeps repeating. How do I prevent this issue?
Private Sub C1AOP5_SelChange(sender As Object, e As CancelEventArgs) Handles C1AOP5.SelChange
s.Clear()
s1.Clear()
For Each row In Me.C1AOP5.SelectedRows
s.Add(C1AOP5.Columns("NSN").CellText(row))
Next
MsgBox("AA")
' C1AOP40T.Refresh()
For i As Integer = 0 To C1AOP40T.Splits(0).Rows.Count - 1
If s1.Contains(C1AOP40T.Columns("NSN").CellText(i)) Then
C1AOP40T.SelectedRows.Add(i)
End If
If s1.Count = 0 Then
C1AOP40T.SelectedRows.Clear()
End If
Next
MsgBox("BB")
C1AOP40T.Refresh()
C1AOP5.Refresh()
e.Cancel = True
MsgBox("CC")
End Sub