tags:

views:

99

answers:

1

Hi all,

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.

+1  A: 

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
Chocol8
No change, I do the Focus() on FormClosing and FormClosed of ChildForm but it doesn't change anything on the parent focus
Haxxius
Firstly i think you should check the tab order of the textboxes on the mainform. Secondly, do you have anything like txt1.focus or similar on the ParentForm activated event?
Chocol8