Custom textbox with dropdownlist behavior
-
Hi I'm currently working on quite a big project and the need for a new custom control has come to our attention. What i´m looking for is a control that should be a combination of a textbox and a dropdownlist in the sense that i want to give the users the possibility to either select an item from the list or enter one themselves. Is there such a control or does anyone have any ideas on how to make one..not new to custom controls just not keane on waisting time starting from scratch if someone allready knows of a good way.. Any ideas are helpful Thanks :~ Henrik
-
Hi I'm currently working on quite a big project and the need for a new custom control has come to our attention. What i´m looking for is a control that should be a combination of a textbox and a dropdownlist in the sense that i want to give the users the possibility to either select an item from the list or enter one themselves. Is there such a control or does anyone have any ideas on how to make one..not new to custom controls just not keane on waisting time starting from scratch if someone allready knows of a good way.. Any ideas are helpful Thanks :~ Henrik
-
Hey, the standard ComboBox already has this functionality in .NET 2.0. So there should be no reason to write a custom control for this behavior.
-
To my knowledge i doesn't have it, but please let me know what properties in the existing dropdownlist that set this behavior.. Henrik
The standard ComboBox has always had this ability as long as Windows have had ComboBoxes. In fact, it is the default behavior. The ComboBox has a property called DropDownStyle. Options are Simple, DropDown, and DropDownList. Simple makes it act like a TextBox, DropDownList restrict it to a DropDownList only (no typing in the box), and DropDown has both the Dropdown, and text edit. Since you believe it is not already present, I wonder if what you really want is for the text entered by the user to be added to the dropdown list? If so, you would need to add code to do this. I would recommend having an "Add" button, which would add the value of ComboBox1.text to ComboBox1.items (with some code to make sure that the item is not already in the list). Roy.
-
The standard ComboBox has always had this ability as long as Windows have had ComboBoxes. In fact, it is the default behavior. The ComboBox has a property called DropDownStyle. Options are Simple, DropDown, and DropDownList. Simple makes it act like a TextBox, DropDownList restrict it to a DropDownList only (no typing in the box), and DropDown has both the Dropdown, and text edit. Since you believe it is not already present, I wonder if what you really want is for the text entered by the user to be added to the dropdown list? If so, you would need to add code to do this. I would recommend having an "Add" button, which would add the value of ComboBox1.text to ComboBox1.items (with some code to make sure that the item is not already in the list). Roy.
Ok yeah that is true, sorry but i probably should have been more explicit in what i was looking for. What i forgot to mention is that i'm working on a web project so thats why i can't use the ComboBox youre suggesting. So what i'm looking for is a way to change a the webcontrol DropDownList to behave like a standard WinForm ComboBox. Thanks for youre replies though. :) Henrik