Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Docking Pane
  New Posts New Posts RSS Feed - SetFocus error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SetFocus error

 Post Reply Post Reply
Author
Message
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Topic: SetFocus error
    Posted: 11 June 2009 at 11:02am
I have some vb textboxes on a Frame which is on a Tab control. All this is on a Form in an MDI child using DockingPane.

To move user from one text box to another, I use  textbox(x).SetFocus

This 95% works OK, but sometimes gives error.
I think this error is same as if textbox is not enabled or not visible.

I guess this is a timing error or similar.  Most times the SetFocus is fine. But sometimes I guess the DockingPane is busy doing something and the SetFocus gives error.   (without the DockingPane it always works OK.)


Any ideas to workaround this?
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
Back to Top
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 11:43am
Possible workaround

The following sort of thing seems to work OK

Sub AttemptSetFocus(myControl)
     On Error Goto ERR_SF
     For X = 1 to 5
         myControl.SetFocus
         Exit Sub
    
         ERR_SF:
         DoEvents
     Next
End Sub


(Note this is not real code. Just to give the idea).
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.093 seconds.