Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Combo box class

Combo box class

Scheduled Pinned Locked Moved Windows Forms
csstutorialquestion
3 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    paulsmithx
    wrote on last edited by
    #1

    Hi there, I'm trying to create a class of combo box that allows users to select from a list of filter otpions. In the class declaration I have the following: ... public filterTypeComboBox() : base() { DataSource = null; this.Items.Add("= (equals)"); this.Items.Add("<> (not equal)"); this.Items.Add("<= (less than or equal to)"); this.Items.Add("< (less than)"); ... } ... When I add an instance of the filter combo it duplicates the list of items. Any ideas how to prevent this, or more importantly why this happens? (As a temporary workaround I have commented out the duplicates in the designer). Thanks Paul

    C 1 Reply Last reply
    0
    • P paulsmithx

      Hi there, I'm trying to create a class of combo box that allows users to select from a list of filter otpions. In the class declaration I have the following: ... public filterTypeComboBox() : base() { DataSource = null; this.Items.Add("= (equals)"); this.Items.Add("<> (not equal)"); this.Items.Add("<= (less than or equal to)"); this.Items.Add("< (less than)"); ... } ... When I add an instance of the filter combo it duplicates the list of items. Any ideas how to prevent this, or more importantly why this happens? (As a temporary workaround I have commented out the duplicates in the designer). Thanks Paul

      C Offline
      C Offline
      Ch_Shahzad iqbal
      wrote on last edited by
      #2

      in First line U Call the this.items.clear()

      P 1 Reply Last reply
      0
      • C Ch_Shahzad iqbal

        in First line U Call the this.items.clear()

        P Offline
        P Offline
        paulsmithx
        wrote on last edited by
        #3

        Curiouser and curiouser... that seemed to do the trick, at least partially as the designer code now reads: ... this.m_FilterTypeComboBox1.Items.AddRange(new object[] { "= (equals)", "<> (not equal)", ... "begins with", "ends with"}); ... However, this is quite strange, when I run the form the combo box lists exactly 2 set of the list when I scroll down using the thumb, however when I scroll using the arrow it only scrolls through 1 set. ie The combo box items are: = (equals) <> (not equal) ... begins with ends with = (equals) <> (not equal) ... begins with ends with but when I press the down arrow to cycle through the options it gets to ends with and the next item is back to the top of the list. I'm stumped! Thanks, Paul

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups