Could someone help iterating through DevExpress TextEdit controls within an XTRAFORM in vb.net?
What I am actually trying to do is to intercept any value changes at FormClosing event by using EditValue and OldEditValue properties.
I meight need to tell that my controls are contained in XtraTab and XtraPanel Containers.
the following is what I tried:
Public Function TextEditChangesOccured(frm As XtraForm) As Boolean
Dim result As Boolean
For Each ctrl As BaseEdit In frm.Controls
If TypeOf ctrl Is TextEdit Then
If ctrl.EditValue <> ctrl.OldEditValue Then
result = True
Else
result = False
End If
End If
Next
Return result
End Function
Private Sub MyXtraForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If TextEditChangesOccured(Me) Then
DevExpress.XtraEditors.XtraMessageBox.Show("Changes have occured!", My.Application.Info.AssemblyName, MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
but it says unable to cast XtraTab control to TextEdit control.
Your help will be much appreciated.
To make your code works just change your code snippet as follows:
To detect changes for all the editors within a Form use the following approach: