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