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. determine selected index changed event of combo of datagridview

determine selected index changed event of combo of datagridview

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
4 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.
  • R Offline
    R Offline
    Rupesh Kumar Swami
    wrote on last edited by
    #1

    hi all, i have a datagridview in my program. i add column of combo type at run time .Now my problem is that how can i detect selected index change event of this combo.

    Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company

    D 1 Reply Last reply
    0
    • R Rupesh Kumar Swami

      hi all, i have a datagridview in my program. i add column of combo type at run time .Now my problem is that how can i detect selected index change event of this combo.

      Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Youre trying to treat that ComboBox like it's the same one you drop on a form. It's not. That combo is buried under a DataGridViewComboBoxCell as the cell's Edit Control, which is buried under a DataGridViewComboBoxColumn. What do you think you need this for?? Under any normal circumstances, if your dataset/datatable, dgv is configured correctly, you would never need to handle this event.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      W 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Youre trying to treat that ComboBox like it's the same one you drop on a form. It's not. That combo is buried under a DataGridViewComboBoxCell as the cell's Edit Control, which is buried under a DataGridViewComboBoxColumn. What do you think you need this for?? Under any normal circumstances, if your dataset/datatable, dgv is configured correctly, you would never need to handle this event.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        W Offline
        W Offline
        WhiteGirl23
        wrote on last edited by
        #3

        use the event cellendedit. Dim indexcombo As Integer = 0 If e.ColumnIndex = 0 Then indexcombo = CType(Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewComboBoxCell).Items.IndexOf(Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString) End If valoareCombo = Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex).Value where the indexcombo is the index you choosed in combo.

        D 1 Reply Last reply
        0
        • W WhiteGirl23

          use the event cellendedit. Dim indexcombo As Integer = 0 If e.ColumnIndex = 0 Then indexcombo = CType(Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewComboBoxCell).Items.IndexOf(Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString) End If valoareCombo = Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex).Value where the indexcombo is the index you choosed in combo.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          That's why I asked him why he needs this. Your using an event that doesn't fire until the new value is commited to the cell. Is he looking for that?? Or is he looking to find out BEFORE the value is commited?? That's why I asked...

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          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