locked
How to reset a combobox to null with style list.... RRS feed

  • Question

  • I have a combobox with a dropdownstyle of dropdownlist (style 2).  When a user finishes making entries and clears the form, I want the display value of this to return to null.  With an unrestricted combobox, I could just set .text="" and be good to go; that doesn't work with the ones that are restricted.  :-)  How do I set this to null again?
    Tuesday, November 16, 2010 3:17 PM

Answers

  • The normal set to initial of a combobox is 

    combobox1.SelectedIndex = -1


    Success
    Cor
    • Proposed as answer by Omie Wednesday, November 17, 2010 11:52 AM
    • Marked as answer by Kee Poppy Tuesday, November 23, 2010 7:59 AM
    Wednesday, November 17, 2010 11:36 AM

All replies

  • Change the DropDownStyle to something else.  Clear the ComboBox.Items collection.  Change the DropDownStyle back DropDownList. 

    It is not letting you write to it for the same reason it does not a user write to it, or change the data. 

    Rudy   =8^D


    Mark the best replies as answers. "Fooling computers since 1971."

    http://rudedog2.spaces.live.com/default.aspx

    Tuesday, November 16, 2010 7:15 PM
  • Seriously?  You can't just change the index to zero or something like that to go back to null?  
    Wednesday, November 17, 2010 11:24 AM
  • The normal set to initial of a combobox is 

    combobox1.SelectedIndex = -1


    Success
    Cor
    • Proposed as answer by Omie Wednesday, November 17, 2010 11:52 AM
    • Marked as answer by Kee Poppy Tuesday, November 23, 2010 7:59 AM
    Wednesday, November 17, 2010 11:36 AM