none
How can I make the list box scroll to selected item

    Question

  • Hi All,

    I have a textbox that searches the listbox below it and selects the text that I types in the textbox.

    Now although the item is selected in the listbox I have to scroll to the end to see if the item is selected ornot

    IS there a way that I can make the list box scroll to the selected item?

    • Moved by Liliane Teng Wednesday, September 15, 2010 10:15 AM Please repost on appropriate forums for better support (From:Visual Basic General)
    Thursday, September 09, 2010 2:57 PM

All replies

  • use 

    YourListbox.SelectedIndex = YourListbox.FindString(textbox.text) 

    Can be typos or other slight non correct changes in this message, but when you set it in your code you will see it.

    You can also us FindStringExact which does like it tells.

     

     

     


    Success
    Cor
    • Proposed as answer by kleinmaMVP Thursday, September 09, 2010 3:16 PM
    Thursday, September 09, 2010 3:05 PM
  • .Findstring and .Findstringexact are for windows and I am using a webform. I cant use it.

    Maintain autopostback="true" is achieving the results in one app (on VS2008 ) but not on the app that  I am working on right now.  

    Environment details: (not working)

    • IIS 6 on Win Server 2003
    • The virtual directory is running ASP.NET 2.0.50727
    • I have set maintainScrollPositionOnPostBack="True" in the page directive Any ideas?
    Thursday, September 09, 2010 4:38 PM
  • Hello burtons,

    Welcome to MSDN Forum.

    I have moved your thread to Off-Topic forum. For ASP.NET questions, please repost on appropriate forum as kaymaf suggested for more better and quicker support. Thanks for your understanding.

    Best regards,
    Liliane
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. Thanks
    Wednesday, September 15, 2010 10:19 AM