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. Combobox event

Combobox event

Scheduled Pinned Locked Moved C#
3 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.
  • V Offline
    V Offline
    vasusoftsol
    wrote on last edited by
    #1

    Hi , Is there any event for both the textchange and selectindexchange in combobox {that event must fire when we made any change in the text as well as selectindexchange

    A M 2 Replies Last reply
    0
    • V vasusoftsol

      Hi , Is there any event for both the textchange and selectindexchange in combobox {that event must fire when we made any change in the text as well as selectindexchange

      A Offline
      A Offline
      Anthony Mushrow
      wrote on last edited by
      #2

      There isn't, but just use both events and keep track of them yourself, like:

      bool textChanged = false;
      bool indexChanged = false;

      void TextChanged()
      {
      if(!indexChanged)
      textChanged = true;
      else {
      indexChanged = false
      EventsFired();
      }
      }

      void IndexChanged()
      {
      if(!textChanged)
      indexChanged = true;
      else {
      textChanged = false
      EventsFired();
      }

      }

      void EventsFired()
      {
      //Main code
      }

      My current favourite word is: I'm starting to run out of fav. words!

      -SK Genius

      Game Programming articles start -here[^]-

      1 Reply Last reply
      0
      • V vasusoftsol

        Hi , Is there any event for both the textchange and selectindexchange in combobox {that event must fire when we made any change in the text as well as selectindexchange

        M Offline
        M Offline
        Mbah Dhaim
        wrote on last edited by
        #3

        there are no events for handle both events, specify event handler like this:

        this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
        this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);

        then you perfom actions in

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
        // do something
        }

        this done because both events are apply from System.EventHandler

        dhaim programming is a hobby that make some money as side effect :)

        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