Reputation:
I got a form with two textbox which show a child form OnClickEvent.
I do work in the child form and when I dispose it, I'll like to give focus to the second main form's textbox.
But it doesn't work, making txtBox2.Focus() and Dispose() on the child form as if the Dispose action lost the focus on main form.
Upvotes: 0
Views: 647
Reputation: 9959
1) Try using ChildForm.close instead of ChildForm.dispose
2) Set the focus on the ChildForm_FormClosing event
Private Sub ChildForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
parentForm.txt2.focus
End Sub
Upvotes: 1