H
Harry
Hi All
VS 2008 Pro
It appears that the form_closing event of a form may not always fire. I put
an explicit lock on a customer record when it is open for edit and then
remove the lock in the form_closing event when the form is closed. This used
to work fine in VB6 but appears to be a bit unreliable in VB.Net.
code------------------------------------------------------------------
Private Sub frmAccount_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Select Case Ask_Save(oAccount.IsDirty)
Case Windows.Forms.DialogResult.Cancel
e.Cancel = True
Return
Case Windows.Forms.DialogResult.No
oAccount.Fetch() 'refresh the data
Case Windows.Forms.DialogResult.Yes
oAccount.Operator_ID = Glo.OperatorID
_DataChanged = oAccount.Save()
End Select
'--------------------
'clear user form lock
'--------------------
ClearLock(oLock)
End Sub
Can anyone offer any suggestions on how to overcome this. Should I use the
form_disposed event or perhaps the Finalise method?
Thank you for any input
Harry
VS 2008 Pro
It appears that the form_closing event of a form may not always fire. I put
an explicit lock on a customer record when it is open for edit and then
remove the lock in the form_closing event when the form is closed. This used
to work fine in VB6 but appears to be a bit unreliable in VB.Net.
code------------------------------------------------------------------
Private Sub frmAccount_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Select Case Ask_Save(oAccount.IsDirty)
Case Windows.Forms.DialogResult.Cancel
e.Cancel = True
Return
Case Windows.Forms.DialogResult.No
oAccount.Fetch() 'refresh the data
Case Windows.Forms.DialogResult.Yes
oAccount.Operator_ID = Glo.OperatorID
_DataChanged = oAccount.Save()
End Select
'--------------------
'clear user form lock
'--------------------
ClearLock(oLock)
End Sub
Can anyone offer any suggestions on how to overcome this. Should I use the
form_disposed event or perhaps the Finalise method?
Thank you for any input
Harry