listbox focus

Last post 06-27-2006, 10:54 PM by Damon. 1 replies.
Sort Posts: Previous Next
  •  06-27-2006, 12:21 PM Post number 912

    listbox focus

    Hi

     

    Is there any way to make a listbox control NOT get focus? I have a form with a text box and a list box on it and when people select an item in the list box I don’t want focus to move off the text box.

     

    thanks in advance

     

    J

  •  06-27-2006, 10:54 PM Post number 922 in reply to post number 912

    • Damon is not online. Last active: 12-02-2008, 6:48 PM Damon
    • Top 10 Contributor
    • Joined on 06-26-2006
    • Dallas, TX
    • Acorn Archimedes

    Re: listbox focus

    In short, no (but it may not be an issue).  If your users are clicking on the list box and then selecing an item in that list, then they are interacting with the control.  Any time the user interacts with a control, it's going to have focus.  That's just how it works.

    But, you can always force the focus back to the textbox after the item is selected.  It all depends on what behavior you are trying to get.  If all you're wanting is the focus to be back on the textbox once the user has selected the item, then it shouldn't be a problem.  You just have to call the focus() method on the textbox (I think that's what it's called, it's been a while since I did win forms) from inside the event that fires when the user selects an item from the list box (probably something like like the itemSelected event).


    Damon Armstrong, Technology Consultant
    [Blog] [Articles]
View as RSS news feed in XML