Click here to Skip to main content
15,878,970 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to know Which event fires when vb.net form lost it's focus? I am using Krypton Navigator.

I am using the following code to show a form.
private sub showForm(byval pform as form
VB
Dim kryPage As New KryptonPage

Me.kryNavi.Pages.Add(kryPage)

With pform

.TopLevel = False

.Parent = kryPage

.Dock = DockStyle.Fill

.BringToFront()

.Show()

.Activate()

End With

end sub


I am using the above code to show a form.

Reply Quote
Posted
v2

1 solution

This issue can really be confusing. Formally, the form has focus-related properties, but in a very different way than controls.

The "focus" always means keyboard focus, and it is something functional for focusable controls, not forms. A form is activated or deactivated, and when it is activated, the focus goes to the control which was focused before is any.

So, you can handle the events when each control is focused, or, you rather need to handle the event System.Windows.Forms.Form.Activated or System.Windows.Forms.Form.Deactiveate. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.activated.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.deactivate.aspx[^].

—SA
 
Share this answer
 
v2
Comments
Espen Harlinn 5-Dec-12 18:11pm    
5
Sergey Alexandrovich Kryukov 5-Dec-12 21:58pm    
Thank you, Espen.
--SA
kgmmurugesh 7-Dec-12 5:36am    
I vb6, when we close a form it fires form_unload event, when we show a form it fires form_load, form_Activate event, when the user goes from form A to another form then he return to the form A, it fires form_activate event. I need the equivalent event in vb.net
Sergey Alexandrovich Kryukov 7-Dec-12 14:19pm    
Why are you asking about VB6 at all? I rather would reply "forget it"... Your question was about VB.NET, so consider accepting the answer formally (green button) -- thanks.
--SA
kgmmurugesh 8-Dec-12 4:43am    
My actual requirement is to note the active control of a form when user go to another form without closing the current form.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900