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. how do I lock a combo box but still allow the user to view the contents

how do I lock a combo box but still allow the user to view the contents

Scheduled Pinned Locked Moved Windows Forms
question
6 Posts 2 Posters 16 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.
  • D Offline
    D Offline
    dove11
    wrote on last edited by
    #1

    I have seen a way to do this a week ago, but cannot find the link. I want the user to view all the items in the combo box, but I don't want them to change the value. Has anyone seen this link or know the answer? The combo box is on the form. It is not in any other control. Thanks

    D 1 Reply Last reply
    0
    • D dove11

      I have seen a way to do this a week ago, but cannot find the link. I want the user to view all the items in the combo box, but I don't want them to change the value. Has anyone seen this link or know the answer? The combo box is on the form. It is not in any other control. Thanks

      D Offline
      D Offline
      dove11
      wrote on last edited by
      #2

      This is VB .Net

      T 1 Reply Last reply
      0
      • D dove11

        This is VB .Net

        T Offline
        T Offline
        Tirthadip
        wrote on last edited by
        #3

        Combobox1.DropDownStyle = ComboBoxStyle.DropDownList

        Tirtha Miles to go before I sleep

        D 1 Reply Last reply
        0
        • T Tirthadip

          Combobox1.DropDownStyle = ComboBoxStyle.DropDownList

          Tirtha Miles to go before I sleep

          D Offline
          D Offline
          dove11
          wrote on last edited by
          #4

          I have tried this already and it still allows the user to select another item (other than the original selected item) in the dropdownlist. This is what I want to prevent. I want them to view it, but not select another item. I want it locked.

          T 1 Reply Last reply
          0
          • D dove11

            I have tried this already and it still allows the user to select another item (other than the original selected item) in the dropdownlist. This is what I want to prevent. I want them to view it, but not select another item. I want it locked.

            T Offline
            T Offline
            Tirthadip
            wrote on last edited by
            #5

            Then why you are not using ComboBox1.Enabled=False after Selecting the item.......Moreover what do u actually want to do by that...why are u using combo when u dont want your user to select item from it???I am bit confused.....

            Tirtha Miles to go before I sleep

            D 1 Reply Last reply
            0
            • T Tirthadip

              Then why you are not using ComboBox1.Enabled=False after Selecting the item.......Moreover what do u actually want to do by that...why are u using combo when u dont want your user to select item from it???I am bit confused.....

              Tirtha Miles to go before I sleep

              D Offline
              D Offline
              dove11
              wrote on last edited by
              #6

              Hi. I ended up temporarily doing the following: F2.cmbPub.SelectedValue = strPub F2.cmbPub.Enabled = False F2.cmbPub.DropDownStyle = ComboBoxStyle.Simple This disables the box showing the selected value only. I am coming from a browse screen that has a datagrid with 2 unbound boolean columns, Edit and Delete. The rest of the columns are bound. When I check the Edit box it shows the detail screen with the information for the selected item. I just wanted to be able to allow the user to display the values in the combo box, but not be able to select from it. I wanted the default to be the selected value. I will use the above code for now, but just wanted to know if there was a way to do it. Thanks.

              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