Eric
Eric

Reputation: 248

how to know my application lost focus in VB.NET

I am using VB.NET to build my application. And in my application has a lot of Forms. It doesn't use MDI Parent Form, but I use another simple Window Form (I named it frmMain) that I suppose it is my MDI Parent Form. When frmMain load, windowState = Maximized. And when I open a Form (example: I named it frmCustomer) that I suppose it is my child Form, and I set its properties (frmCustomer.TopMost=True) when it load, so it always on the top. But When I change to open another application such as Ms. Word or Mozilla Firefox... the frmCustomer is still on the top. My question is that; how can I know my frmMain lost focus?

Upvotes: 0

Views: 1093

Answers (1)

Steven Doggart
Steven Doggart

Reputation: 43743

If you want the form to stay in front of the main form, but not other applications, the simpler solution would be to set the main form as the child form's owner. For instance:

childForm.Show(parentForm)

or

childForm.Owner = parentForm

Upvotes: 2

Related Questions