Get focus on a form

  • Thread starter Thread starter Wan
  • Start date Start date
W

Wan

Hi,
I have a small test project consists of two simple forms. The main
form contains a datagrid and upon doubleclick event of grid I bring up
a detail form that contains few controls, drop-down, textboxes &
button. if I double click the second time, detail form shows up again
- so far so good. Here is the problem - if I go back to the first
instance of detail form and try to click on add button then the focus
goes back to second instance of detail form. I would like to open
multiple instances of detail form for data comparison purposes. Is it
possible to keep the focus on the same selected form?

-- double click event
Dim frmD as new frmDetail
frmD.show
 
You can tell your app to focus on the first instance.

MyControl.Focus(MyFirstInstanceControl)

Or if you dynamically add the controls...

MyControl.Focus(MyControl.Controls(0))

Hope this helps.
 
Back
Top