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. C#
  4. Custom textbox with dropdownlist behavior

Custom textbox with dropdownlist behavior

Scheduled Pinned Locked Moved C#
tutorial
5 Posts 3 Posters 0 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.
  • H Offline
    H Offline
    hansdredd
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • H hansdredd

      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

      H Offline
      H Offline
      hooray
      wrote on last edited by
      #2

      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.

      H 1 Reply Last reply
      0
      • H hooray

        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.

        H Offline
        H Offline
        hansdredd
        wrote on last edited by
        #3

        To my knowledge i doesn't have it, but please let me know what properties in the existing dropdownlist that set this behavior.. Henrik

        R 1 Reply Last reply
        0
        • H hansdredd

          To my knowledge i doesn't have it, but please let me know what properties in the existing dropdownlist that set this behavior.. Henrik

          R Offline
          R Offline
          Roy Heil
          wrote on last edited by
          #4

          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.

          H 1 Reply Last reply
          0
          • R Roy Heil

            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.

            H Offline
            H Offline
            hansdredd
            wrote on last edited by
            #5

            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

            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