I haven't had any luck finding a solution to this problem:
Given an MDI app, the user opens a new document window. In the ID text field, they type an ID (say "123"). They open another child document and type the ID "123" again. What I need to do is close the most recent child document and give focus back to the document that already had "123" as the ID.
The code I am trying to use:
I also posted this problem at VisualBasicForum.com (in the .Net section) but haven't found a solution yet.
http://www.visualbasicforum.com/showthread.php?t=232374
tia,
flynn
Given an MDI app, the user opens a new document window. In the ID text field, they type an ID (say "123"). They open another child document and type the ID "123" again. What I need to do is close the most recent child document and give focus back to the document that already had "123" as the ID.
The code I am trying to use:
Code:
Private Sub txtFolioNumber_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFolioNumber.LostFocus
Dim frm As frmDocument
For Each frm In Me.MdiParent.MdiChildren
'no need to check myself (the current form)
If (Me.Handle.ToInt32 <> frm.Handle.ToInt32) Then
'if the number just entered is already used on another form, switch to that form
If (frm.txtFolioNumber.Text = txtFolioNumber.Text) Then
frm.TopMost() = True
Me.Close()
End If
End If
Next frm
End Sub
I also posted this problem at VisualBasicForum.com (in the .Net section) but haven't found a solution yet.
http://www.visualbasicforum.com/showthread.php?t=232374
tia,
flynn