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. Combo Boxes in Windows Forms (Data Binding)

Combo Boxes in Windows Forms (Data Binding)

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

    A question concerning the behavior... Ex. I bind the data to a DataSet in the Form_Load() event. I have an event that is triggered when on the SelectedIndex_Changed event. On the load, the DataBind is causing the SelectedIndex event to fire which sort of makes sense. Is there flag or property I can set around the code block which binds the data to force it not to trigger that event.

    A D 2 Replies Last reply
    0
    • C codycaillet

      A question concerning the behavior... Ex. I bind the data to a DataSet in the Form_Load() event. I have an event that is triggered when on the SelectedIndex_Changed event. On the load, the DataBind is causing the SelectedIndex event to fire which sort of makes sense. Is there flag or property I can set around the code block which binds the data to force it not to trigger that event.

      A Offline
      A Offline
      A Wegierski
      wrote on last edited by
      #2

      There's no flag like this, I think. Create Your own - or - disconnect handler before DataBind and connect it after loading data Hi, AW

      1 Reply Last reply
      0
      • C codycaillet

        A question concerning the behavior... Ex. I bind the data to a DataSet in the Form_Load() event. I have an event that is triggered when on the SelectedIndex_Changed event. On the load, the DataBind is causing the SelectedIndex event to fire which sort of makes sense. Is there flag or property I can set around the code block which binds the data to force it not to trigger that event.

        D Offline
        D Offline
        DIPAK EMSYS
        wrote on last edited by
        #3

        It is because.first u are seting the data source and then u might be setting the dispaly member and value member.... u can do like this

        cmbClassId.DisplayMember = dataSet.Tables[Constants.CLASSES].Columns["ClassName"].ToString();
        cmbClassId.ValueMember = dataSet.Tables[Constants.CLASSES].Columns["ClassID"].ToString();
        cmbClassId.DataSource = dataSet.Tables[Constants.CLASSES];

        This will cause event to occure only once.

        dipak

        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