31/07/2012, 15:46
|
| | Fecha de Ingreso: febrero-2012 Ubicación: San juan de luriguashington
Mensajes: 39
Antigüedad: 12 años, 9 meses Puntos: 2 | |
Respuesta: filtrar combox dentro de datagridview vb net amigo me sale erro en el columnindex
y el
DataGridViewComboBox
Private Sub dgvsalud_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlSho wingEventArgs) Handles dgvsalud.EditingControlShowing
If TypeOf e.Control Is DataGridViewComboBoxEditingControl Then ' Validando si el control es de tipo combobox edit
If e.ColumnIndex = 0 Then ' Valida si el index es igual al combo primario en donde vas a realizar el filtro
Dim CellTextBox As DataGridViewComboBoxEditingControl = TryCast(e.Control, DataGridViewComboBoxEditingControl)
RemoveHandler CellTextBox.SelectionChangeCommitted, AddressOf CellTextBox_SelectionChangeCommited
AddHandler CellTextBox.SelectionChangeCommitted, AddressOf CellTextBox_SelectionChangeCommited
End If
End If
End Sub
Sub CellTextBox_SelectionChangeCommited(ByVal sender As Object, ByVal e As EventArgs)
Dim c As ComboBox = TryCast(sender, ComboBox)
Dim value As Object = c.SelectedValue
Dim Combo As DataGridViewComboBox = dgvsalud.Columns(dgvsalud.CurrentCell.ColumnIndex)
Combo.DataSource = lobjTipoSeguro.fcboseguros(value)
Combo.ValueMember = "cod_tipo_seguro"
Combo.DisplayMember = "dsc_tipo_seguro"
End Sub |