Hi.I'm working with an UltraDateTimeEditor and in an special situation I need to avoid the edition.If i use then next code
Private Sub udte1_BeforeEnterEditMode(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles udte1.BeforeEnterEditMode
MessageBox.Show("BeforeEnterEditMode Event")e.Cancel = True
End Sub
any time I click the DropDown Button I get 3 times then "BeforeEnterEditMode Event" message. If I try to edit clicking the textbox I get 2 times the same message.I'm using NetAdvange 12.2 Win CLR4x
Hi,
I just answered a very similar question here: MessageBox in BeforeRowDeactivate affecting ClickCell event - NetAdvantage for Windows Forms - WinGrid
You should try to avoid showing a MessageBox inside events where the focus is already in the process of changing. But you can use the same BeginInvoke technique I used in the other thread to avoid the event problems.
I tried with your example but I still have the same problem, it's looks like enter in an infinite loop.
My code:
Private Sub udte1_BeforeEnterEditMode(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles udte1.BeforeEnterEditMode udte1.BeginInvoke(New MethodInvoker(AddressOf ShowMsg)) e.Cancel = True End Sub Private Sub ShowMsg() Try MessageBox.Show("BeforeEnterEditMode Event") Catch ex As Exception End Try End Sub