Results 1 to 5 of 5

Thread: Combo Box CLear

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954

    Combo Box CLear

    I am loading values into a combo box at load of the app. I have a clear button on my form that I want to clear everything on the form (including any text in these combo boxes). The problem is that I have it so the combo boxes are the style of 2 (Drop down list). I don't want users to be able to type anything in so they can just select what is there. If I say cboIn.text = "" it will break because the text prop is read only. If I do a cboIn.clear, it will clear all fo the contents in the drop down list. I just want it to clear what is in the text prop. Any thoughts?

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Here ya go:
    Code:
    Combo1.listindex=-1

  3. #3
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Can't you use ComboName.ListIndex = 0? That'll select the first list item. I think that's what you mean, sorry if it isn't

  4. #4
    Member
    Join Date
    May 2002
    Location
    Pittsburgh, PA
    Posts
    42
    I don't know too much about combo boxes because I don't use them often, but you could make an annoying If statement, so the user cannot type what they want inside of it, then using cboln.text = "", will work. (This is if you use the style prop #1)

  5. #5
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    To clear the combo box
    VB Code:
    1. Combo1.ListIndex = -1

    To make it so users cant type in combo box
    VB Code:
    1. Private Sub Combo1_KeyPress(KeyAscii As Integer)
    2.     KeyAscii = 0
    3. End Sub

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