I'm working with Windows Forms I have a DataGridView object which people with a list. What I need is that when you select an element of the grid take the index and with that index do the search in the list to update a property that you have.
private void dText_keyDown(object sender, KeyEventArgs e)
{
int rowIndex = ((DataGridViewTextBoxEditingControl) (sender)).EditingControlRowIndex;
_rowIndex = rowIndex;
if (e.Alt && e.KeyCode == Keys.D)
{
var frm = CompositionRoot.Resolve<FrmCantidad>();
_hub.Subscribe<SelectedCantidad>(OnCantidadSelected);
frm.ShowDialog();
_hub.ClearSubscriptions();
}
}
private void OnCantidadSelected(SelectedCantidad obj)
{
if (!string.IsNullOrEmpty(obj.Valor))
{
var list = _saVenta.MostrarVentas().ToList();
if (list)
{
}
.
}
}
The DGV charges it by assigning its DataSource property to the list.