Combo box class
-
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
-
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
in First line U Call the this.items.clear()
-
in First line U Call the this.items.clear()
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