Muchas gracias Dradi, mira adapte tu codigo en C# a mi VB, me funciona bien, almenos ya hago lo que necesitaba.
Pero ahora tengo otro problema q lo posteo aqui mismo. Cuando intento hacer el Guardar. debo de recorrer todas los ROWS del DGVIEW y en la columna AREA necesito saber EL CODIGO del AREA seleccionada en una columna del tipo DATAGRIDVIEWCOMBOBOXCOLUMN, igual solo puedo obternet el VALUE pero yo necesito el CODIGO que corresponde. Bueno gracias por su ayuda, espero puedan ayudarme en este
Aqui le dejo el Codigo que me sirvio para cargar un DGVCOMBOBOXCELL dependiendo de lo que seleccione de otro DGVCOMBOBOXCELL. convertido en VB del codigo que posteo Dradi.
Código:
Private Sub dgvLista_EditingControlShowing _
(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) _
Handles dgvLista.EditingControlShowing
Try
If e.Control.GetType Is GetType(DataGridViewComboBoxEditingControl) Then
Dim cellComboBox As DataGridViewComboBoxEditingControl
cellComboBox = e.Control
RemoveHandler cellComboBox.SelectionChangeCommitted, AddressOf CbComboVerificar
If dgvLista.Columns(Me.dgvLista.CurrentCellAddress.X).Name = "departamento" Then
AddHandler cellComboBox.SelectionChangeCommitted, AddressOf CbComboVerificar
End If
End If
Catch ex As Exception
End Try
End Sub
Private Sub CbComboVerificar(ByVal sender As Object, ByVal e As System.EventArgs)
Dim Combo As ComboBox = sender
Dim obj As clsArea
Dim dtt As New DataTable
Dim cellBox As New DataGridViewComboBoxCell
Try
obj = New clsArea
dtt = obj.obtenerAreasPorDepartamento(Combo.SelectedValue)
cellBox = Me.dgvLista.CurrentRow.Cells("area")
cellBox.DisplayMember = "nombre_area"
cellBox.ValueMember = "codigo_area"
cellBox.DataSource = dtt
Catch ex As Exception
End Try
End Sub