Focus help [VB.NET] [URGENT]

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Focus help [VB.NET] [URGENT]
CodenBoy
Hello, its me again i need help xp

Now I tried much and many codes from utube and tried to make my own it didnt work, so i need to ask,

I want if the form is focus label1.text = "Focused" if from isnt focused then it will say "NotFocused", but actually, the whole form is covered with 1 Panel so should it be about the panel? ?

Please any1 help!

Thanks loove;
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Focus help [VB.NET] [URGENT]
M1z23R
Code: Select all
Private Sub Form1_Activated(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles MyBase.Activated
    Label1.Text = "Focused"
End Sub
Private Sub Form1_Deactivated(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles MyBase.Deactivate
    Label1.Text = "Not focused"
End Sub

Last edited by M1z23R on Sat Aug 11, 2012 3:53 pm, edited 2 times in total.
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Focus help [VB.NET] [URGENT]
mandai
There seem to be some issues with that code. There is no Deactivated event, you should use MyBase.Deactivate instead.
Also the Activated event name is duplicated twice.
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Focus help [VB.NET] [URGENT]
M1z23R
I copy pasted same event, but i think it is the same. Sorry about that, i'll edit it.
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Re: Focus help [VB.NET] [URGENT]
CodenBoy
Thanks #M1z23R , #mandai ,

im so afraid that u r helping alot guys!
5 posts Page 1 of 1
Return to “Coding Help & Support”