issue with datagrid lostfocus event

S

Sam

Hi,
I've got two grids on my form. When one loses the focus I do the
following:

Private inFocusing As Boolean = False

Private Sub dgParams_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles dgParams.LostFocus
If (Not dgParams.ContainsFocus) And (Not inFocusing) Then
If Not save() Then
inFocusing = True 'enter into receiving focus
Try
dgParams.Focus()
SelectRowInGrid(dgParams, 1)
Finally
inFocusing = False ' exit from receiving focus
End Try
End If
End If
End Sub

Private Function save() As Boolean
Return False
End Function

Issue is that it goes twice in Save(). Besides I would like to prevent
a click on a row of a grid, if the Save function returns False in the
lostFocus event of the other grid. How can I do that?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top