Results 1 to 3 of 3

Thread: Setting Focus

  1. #1

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565

    Question

    If when a control recieves focus a certain condition is met, is it possible to set focus back to the control which previously had focus?
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Use LostFocus to set a reference to the control you are moving away from and then just use that reference to set the focus back there...

    i.e.
    Code:
    Dim ctl As Control
    
    
    Sub SomeControl_LostFocus
    
    Set ctl = Me.SomeControl
    
    End Sub
    
    
    Sub OtherControl_GotFocus
    
    If Condition Then
      ctl.SetFocus
    End If
    
    End Sub
    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    Quality, Cheers.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width