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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. disable combobox in c#

disable combobox in c#

Scheduled Pinned Locked Moved C#
csharptutorial
15 Posts 11 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.
  • K Karthik Holla

    You can write it in Select_Index_Change of First DropDown EX:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
    DropDownList2.Enabled = false;
    }

    P Offline
    P Offline
    Pete OHanlon
    wrote on last edited by
    #4

    That doesn't solve the OP's problem.

    1 Reply Last reply
    0
    • K Karthik Holla

      You can write it in Select_Index_Change of First DropDown EX:

      protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
      {
      DropDownList2.Enabled = false;
      }

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #5

      As Pete said, it does not help the OP with his problem. He wants to disable the combo box when it is selected, not when an item is selected...

      "I've seen more information on a frickin' sticky note!" - Dave Kreskowiak

      1 Reply Last reply
      0
      • K Karthik Holla

        You can write it in Select_Index_Change of First DropDown EX:

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
        DropDownList2.Enabled = false;
        }

        R Offline
        R Offline
        Ranjan D
        wrote on last edited by
        #6

        Note the OP is intending to do this for c# windows form application and not for ASP.NET Applications.

        1 Reply Last reply
        0
        • U User 10485057

          how to disable combobox if another combobox is selected in c# windows form application

          diviya murali

          F Offline
          F Offline
          FreaksOfDeveloper
          wrote on last edited by
          #7

          you can use the Click event of the second combobox to enable/disable the first combobox

          private void comboBox2_Click(object sender, EventArgs e)
          {
          comboBox1.Enabled = false;
          }

          http://freaksofdeveloper.blogspot.co.at/

          P 1 Reply Last reply
          0
          • F FreaksOfDeveloper

            you can use the Click event of the second combobox to enable/disable the first combobox

            private void comboBox2_Click(object sender, EventArgs e)
            {
            comboBox1.Enabled = false;
            }

            http://freaksofdeveloper.blogspot.co.at/

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #8

            Is this event fired if the user tabs into the combobox?

            1 Reply Last reply
            0
            • U User 10485057

              how to disable combobox if another combobox is selected in c# windows form application

              diviya murali

              R Offline
              R Offline
              Ramu cs
              wrote on last edited by
              #9

              The simplistic answer would be to set the Enabled state of the ComboBox from the other ComboBox by handling the GotFocus and LostFocus events on that ComboBox.

              T P 2 Replies Last reply
              0
              • R Ramu cs

                The simplistic answer would be to set the Enabled state of the ComboBox from the other ComboBox by handling the GotFocus and LostFocus events on that ComboBox.

                T Offline
                T Offline
                thatraja
                wrote on last edited by
                #10

                Like Pete said?[^]

                thatraja

                Code converters | Education Needed | Improve EverythingNew

                1 Reply Last reply
                0
                • R Ramu cs

                  The simplistic answer would be to set the Enabled state of the ComboBox from the other ComboBox by handling the GotFocus and LostFocus events on that ComboBox.

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #11

                  It's a good answer. Take you long to come up with it?

                  A 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    It's a good answer. Take you long to come up with it?

                    A Offline
                    A Offline
                    akshay25101988
                    wrote on last edited by
                    #12

                    By using Jquery u can do this in web for windows u need handle in code

                    Thanks & Regards Anant Shetty

                    P P 2 Replies Last reply
                    0
                    • A akshay25101988

                      By using Jquery u can do this in web for windows u need handle in code

                      Thanks & Regards Anant Shetty

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #13

                      A couple of points. 1. jQuery isn't magic. You still have to write code. 2. I know how to solve this problem. 3. You replied to the wrong person. 4. How does any of that answer help the poster answer his question?

                      1 Reply Last reply
                      0
                      • U User 10485057

                        how to disable combobox if another combobox is selected in c# windows form application

                        diviya murali

                        E Offline
                        E Offline
                        Emre Ataseven
                        wrote on last edited by
                        #14

                        Do you want to disable all comboboxes except current?

                        Tim Toady Bicarbonate

                        1 Reply Last reply
                        0
                        • A akshay25101988

                          By using Jquery u can do this in web for windows u need handle in code

                          Thanks & Regards Anant Shetty

                          P Offline
                          P Offline
                          phil o
                          wrote on last edited by
                          #15

                          Please avoid textspeak on this forum. Do a favor to your keyboard (and to our eyes), use it entirely.

                          There are two kinds of people in the world: those who separate humankind in two distinct categories, and those who don't. "I have two hobbies: breasts." DSK

                          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