Page 1 of 1

Focus help [VB.NET] [URGENT]

Posted: Sat Aug 11, 2012 1:02 pm
by 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;

Re: Focus help [VB.NET] [URGENT]

Posted: Sat Aug 11, 2012 3:14 pm
by 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


Re: Focus help [VB.NET] [URGENT]

Posted: Sat Aug 11, 2012 3:49 pm
by 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.

Re: Focus help [VB.NET] [URGENT]

Posted: Sat Aug 11, 2012 3:51 pm
by M1z23R
I copy pasted same event, but i think it is the same. Sorry about that, i'll edit it.

Re: Focus help [VB.NET] [URGENT]

Posted: Sat Aug 11, 2012 5:02 pm
by CodenBoy
Thanks #M1z23R , #mandai ,

im so afraid that u r helping alot guys!