Problem with multiple forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

My application makes use of multiple forms. The problem is that if one form
is loaded and shown, and I close this form to go back to the previous form,
the previous form is displayed, but sometimes the focus is returned to a
background app, and not the main app.

My code to show the next form:

Private Sub btnStock_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStock.Click
Dim frmStockGUI As New frmStock
Me.Hide()
frmStockGUI.btnStockCreate.Select()
frmStockGUI.ShowDialog()
Me.Show()
btnStock.Focus()
End Sub

I even set the focus to a button on the main form, but no luck :-(

Any ideas?

Kind regards,
Pieter Kruger
 
Hi,

Try me.focus instead of me.show


Ken
-------------------
Hello,

My application makes use of multiple forms. The problem is that if one form
is loaded and shown, and I close this form to go back to the previous form,
the previous form is displayed, but sometimes the focus is returned to a
background app, and not the main app.

My code to show the next form:

Private Sub btnStock_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStock.Click
Dim frmStockGUI As New frmStock
Me.Hide()
frmStockGUI.btnStockCreate.Select()
frmStockGUI.ShowDialog()
Me.Show()
btnStock.Focus()
End Sub

I even set the focus to a button on the main form, but no luck :-(

Any ideas?

Kind regards,
Pieter Kruger
 

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

Back
Top