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. combo box in DataGridView select item event

combo box in DataGridView select item event

Scheduled Pinned Locked Moved Visual Basic
question
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.
  • S Offline
    S Offline
    steve_rm
    wrote on last edited by
    #1

    Hello, I have a combo box in my datagridview. The user want to select an item form the combo box which could be either 'Ordered', 'Delivered', and 'To be Ordered'. I want an event to fire based on what the user selects. Currently I have used the cell validating event. However, this doesn't work because the user has to select an item, and then select another cell for the event to fire. I am wondering what is the best event to use, so if the user was to click 'Delivered' it will automatically fire an event, without the user having to click into another cell. Me.dgvPendingOrders.EndEdit() If (e.ColumnIndex = cbCol.DisplayIndex) Then 'If the value in the cell is DBNull then do not process this value If Not (Convert.IsDBNull(Me.dgvPendingOrders.CurrentRow.Cells("StatusPending").Value)) Then status = Me.dgvPendingOrders.CurrentRow.Cells("StatusPending").Value If (status = "Delivered") Then 'Do something here end if end if end if This is my code so far, if anyone has any suggestion or code examples, i would be most gratefull.

    K C 2 Replies Last reply
    0
    • S steve_rm

      Hello, I have a combo box in my datagridview. The user want to select an item form the combo box which could be either 'Ordered', 'Delivered', and 'To be Ordered'. I want an event to fire based on what the user selects. Currently I have used the cell validating event. However, this doesn't work because the user has to select an item, and then select another cell for the event to fire. I am wondering what is the best event to use, so if the user was to click 'Delivered' it will automatically fire an event, without the user having to click into another cell. Me.dgvPendingOrders.EndEdit() If (e.ColumnIndex = cbCol.DisplayIndex) Then 'If the value in the cell is DBNull then do not process this value If Not (Convert.IsDBNull(Me.dgvPendingOrders.CurrentRow.Cells("StatusPending").Value)) Then status = Me.dgvPendingOrders.CurrentRow.Cells("StatusPending").Value If (status = "Delivered") Then 'Do something here end if end if end if This is my code so far, if anyone has any suggestion or code examples, i would be most gratefull.

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      Maybe I am off base here, but I am pretty sure the combobox should fire a selectedindexchanged event. Why don't you just use that? Ben

      S 1 Reply Last reply
      0
      • K kubben

        Maybe I am off base here, but I am pretty sure the combobox should fire a selectedindexchanged event. Why don't you just use that? Ben

        S Offline
        S Offline
        steve_rm
        wrote on last edited by
        #3

        Hello, Thanks for the reply. However, the dataGridView combobox does not have a selectIndexChanged event. Anymore suggestions would be most helpful. Steve

        1 Reply Last reply
        0
        • S steve_rm

          Hello, I have a combo box in my datagridview. The user want to select an item form the combo box which could be either 'Ordered', 'Delivered', and 'To be Ordered'. I want an event to fire based on what the user selects. Currently I have used the cell validating event. However, this doesn't work because the user has to select an item, and then select another cell for the event to fire. I am wondering what is the best event to use, so if the user was to click 'Delivered' it will automatically fire an event, without the user having to click into another cell. Me.dgvPendingOrders.EndEdit() If (e.ColumnIndex = cbCol.DisplayIndex) Then 'If the value in the cell is DBNull then do not process this value If Not (Convert.IsDBNull(Me.dgvPendingOrders.CurrentRow.Cells("StatusPending").Value)) Then status = Me.dgvPendingOrders.CurrentRow.Cells("StatusPending").Value If (status = "Delivered") Then 'Do something here end if end if end if This is my code so far, if anyone has any suggestion or code examples, i would be most gratefull.

          C Offline
          C Offline
          cutequencher
          wrote on last edited by
          #4

          hi! there's an index change in the combobox... maybe you didnt declare it as withevents do you use namespace for it?if so, can you paste your code to make it clear...

          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