Results 1 to 6 of 6

Thread: Clearing ComboBoxes . . .kind of.

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    2

    Clearing ComboBoxes . . .kind of.

    Not going to lie, I am kind of new at this programming thing. My problem is that I want to be able to have a clear button on my form that allows the user to clear out the choices they have selected from several comboboxes. However, I do not want to use

    cmbVar.Items.Clear()

    because it clears out all of the choices that I have added. How do I make a button remove the users choice but does not remove the choices from the combobox. I hope that this makes sense. The way I have it coded now, when you click the Clear button, it completely clears out the combobox and there are no items to choose from.

    Thanks in advance, it is greatly appreciated !

    ~zer0dmb

  2. #2
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    cmbVar.text = ""

    is that what you are looking for?

  3. #3
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    If I understand right, maybe something like
    VB Code:
    1. If ComboBox1.SelectedIndex <> -1 Then
    2.             ComboBox1.Items.RemoveAt(ComboBox1.SelectedIndex)
    3.         End If
    ?

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    2
    I figured it out, thanks for your replies though. I ened up going with :

    cmbRelat_2.SelectedIndex = -1

    Thanks again for your help !

    ~zer0dmb

  5. #5
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Glad you got it going zer0dmb, guess I did not understand your original question.

  6. #6
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    good deal. That's ALMOST the same as what i was thinking but actually, your's is a better solution.

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