Problem with Focus and LostFocus Events 
Author Message
 Problem with Focus and LostFocus Events


I created a control that inherits from TextBox, so when it receives the
focus the text alignment change to right and when it lost focus the
alignment change to left, so i override the OnFocus and OnLostFocus to
change the text alignment. The problem is when i change the alignment the
OnFocus event is fired again. I have tried to use the Enter and Leave but
without any luck too. How can i do it?

    Protected Overrides Sub OnEnter(ByVal e As System.EventArgs)
        MyBase.BackColor = System.Drawing.Color.Yellow
    End Sub

    Protected Overrides Sub OnLeave(ByVal e As System.EventArgs)
        MyBase.BackColor = lcl_BackColor_Original
    End Sub

Note: i can't precise but i think i had this working with SP1 of FrameWork.
I'm working with W2K SP3 + .NET SP2.

R Sousa

Wed, 09 Feb 2005 01:21:59 GMT  
 [ 1 post ] 

 Relevant Pages 

1. LostFocus Event Problem

2. LostFocus event problem

3. use validate event to replace lostfocus event

4. VB Grid RowColChange Event Vs TextBox LostFocus Event

5. Anyway to set focus back on LostFocus?

6. LostFocus doesn't go off when option button gets focus

7. Cancel a control's lostfocus before another control gets the focus

8. Intercept LostFocus / Retain focus

9. lost focus and got focus event

10. problem getting focus events right

11. Access97: Problems with timer events moving the focus for RunCommand

12. Problem setting focus to specific control from form load event


Powered by phpBB® Forum Software