By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,475 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Problem with multiple forms

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Try me.focus instead of me.show
Ken
-------------------
"pkruger" <pk*****@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
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
Nov 21 '05 #2

P: n/a
Hi,

Thank you, this solved my problem.

Best regards,
Pieter

"Ken Tucker [MVP]" wrote:
Hi,

Try me.focus instead of me.show
Ken
-------------------


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.