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. Visual Basic
  4. Datagridview combo box Binding problem

Datagridview combo box Binding problem

Scheduled Pinned Locked Moved Visual Basic
wpfwcfhelpquestion
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.
  • A Offline
    A Offline
    Amit Agarrwal
    wrote on last edited by
    #1

    I have two combo box in Datagridview. one is Department and Manager.Initially i'm binding All the Department and All Manager in dropdown. when select the department then manager combo should bind with selected department manager. I have done till here. but i'm facing a problem if i select one department in first row then it binds All rows with selected department's manager value. i want to bind it row wise. so every column in different row bind accroding to its department row wise. any suggestion?

    Amit Agarwal

    J I 2 Replies Last reply
    0
    • A Amit Agarrwal

      I have two combo box in Datagridview. one is Department and Manager.Initially i'm binding All the Department and All Manager in dropdown. when select the department then manager combo should bind with selected department manager. I have done till here. but i'm facing a problem if i select one department in first row then it binds All rows with selected department's manager value. i want to bind it row wise. so every column in different row bind accroding to its department row wise. any suggestion?

      Amit Agarwal

      J Offline
      J Offline
      Jay Royall
      wrote on last edited by
      #2

      So are you saying that you want to update the current row only? If so then you can use the grdMyGrid.CurrentRow property. When you change the value of your department dropdown, the CurrentCell property is set which in turn sets the CurrentRow property. You can then use something like

      grdMyGrid.CurrentRow.Cells("ManagerCell").value = ManagerValue

      If this is not what you meant then I apologise and can you post some of your code so I/we can get a better idea of the problem.

      1 Reply Last reply
      0
      • A Amit Agarrwal

        I have two combo box in Datagridview. one is Department and Manager.Initially i'm binding All the Department and All Manager in dropdown. when select the department then manager combo should bind with selected department manager. I have done till here. but i'm facing a problem if i select one department in first row then it binds All rows with selected department's manager value. i want to bind it row wise. so every column in different row bind accroding to its department row wise. any suggestion?

        Amit Agarwal

        I Offline
        I Offline
        Indra PR
        wrote on last edited by
        #3

        If the relation is one-to-one, I think you can do something like this:

        Me.cboDepartment.DataBindings.Clear()
        Me.cboDepartment.DataBindings.Add(New Binding("SelectedValue", Me.cboManager, "SelectedValue"))

        I assumed that you made your combobox setting like this:

        cboDepartment.ValueMember = "manager"
        cboDepartment.DisplayMember = "department"

        cboManager.ValueMember = "manager"
        cboManager.DisplayMember = "manager"

        So the program will read it like this:

        cboDepartment.SelectedValue = cboManager.SelectedValue
        cboManager.SelectedValue = cboDepartment.SelectedValue

        Thanks, I hope this can answer your question. Best Regard, Indra Permana Rusli

        - No Signature Available -

        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