Lost focus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philipp

    #1

    Lost focus

    Hi NG,

    Is there a way to know which control just lost focus when clicking on a
    button?
    (other than keeping an object variable which is set when a control loses
    focus)?

    Thanks in advance!

    Greets
    Philipp


  • Phill W.

    #2
    Re: Lost focus

    Philipp wrote:
    [color=blue]
    > Is there a way to know which control just lost focus when clicking on a
    > button?[/color]

    I've used this in a custom Button class.

    Class myButton
    Inherits Button

    Protected Overrides Sub OnClick(ByVal e As System.EventArg s)

    If Not (Me.FindForm Is Nothing) _
    AndAlso Not (Me.FindForm.Ac tiveControl Is Me) _
    Then
    Me.Focus()
    End If

    MyBase.OnClick( )

    End Sub

    End Class

    I haven't tried, but you /might/ be able to do the same sort of thing in
    the event handler for an "ordinary" Button's Click event.

    HTH,
    Phill W.

    Comment

    Working...