Results 1 to 3 of 3

Thread: setfocus help needed

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    62

    setfocus help needed

    i my textbox lostfocus event, i have written a code and at the end of processing of code, the focus should return again to the same textbox.

    i am using lostfocus event, because i want to enter barcode numbers in a form through a barcode scanner, and the scanner triggers lostfocus event after entering one value. hence no chance of using other event for my code except lostfocus.

    when the processing is done (actually saving the barcode + other info into databasE) the same textbox should be ready to take next input without any user help.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: setfocus help needed

    Barcodes have special start/stop characters. Usually the * for 3of9.

    So if I understand correctly, your scanner triggers the LF event after the
    entire barcode has been entered?

    You could just call the Text1.SetFocus method at the end?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Re: setfocus help needed

    i sometimes have an issue returing focus to an object that has lost focus.

    usually set focus to another object on the form first, then you should be able to return it to the first object in question.
    if you fail to plan, you plan to fail

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