
07/04/2015, 11:40
|
| | Fecha de Ingreso: abril-2015
Mensajes: 1
Antigüedad: 9 años, 10 meses Puntos: 0 | |
Respuesta: Actualizar combobox dentro de un datagridview Hola Amigo, yo ago lo que necesitas pero de una forma diferente:
GetAllElements("Select Almacen From AlmacenesUbicaciones Group by Almacen", DataGridView2)
Dim apt As String
For Each Row As DataGridViewRow In Me.DataGridView2.Rows
apt = Row.Cells(0).Value
Almacen.Items.Add(apt)
Next
primero cargo los registros de mi tabla en un datagridview, luego con For Each recorro cada fila y la boy agregando al combo box del datagridview, y para realizar una accion al cambiar el valo del combo ago lo siguiente:
Private Sub DataGridView1_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
If DataGridView1.Columns(e.ColumnIndex).Name = "Almacen" Then
'eliminar row
GetAllElements("Select Ubicacion From AlmacenesUbicaciones Where Almacen = '" & DataGridView1.Item(5, DataGridView1.CurrentRow.Index).Value & "'", DataGridView2)
Dim apt As String
Ubicacion.Items.Clear()
For Each Row As DataGridViewRow In Me.DataGridView2.Rows
apt = Row.Cells(0).Value
Ubicacion.Items.Add(apt)
Next
End If
End Sub
Saludos |