Bonjour
Dans mon programme j'ai 2 datagridview un a coté de l'autre.
Celui de droite possède un scrollbar vertical. Lorsque je le fait bouger, les 2 datagridview sont synchro . Donc c'est bien
voici le code:
J'essaye de faire de même avec le déplacement dans les cellules ( flèches, Enter ,... ). mais là problème car en changeant de cellule dans un datagridview, la sélection change bien dans le second, MAIS vu qu'elle a a changé dans le second elle rechange dans le première.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 private void DgStockCourantDetail_Scroll(object sender, ScrollEventArgs e) { DgStockCourant.FirstDisplayedScrollingRowIndex = DgStockCourantDetail.FirstDisplayedScrollingRowIndex; }
Casse tête
Une idée, un conseil,...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 private void DgStockCourant_SelectionChanged(object sender, EventArgs e) { if (DgStockCourant.Rows.Count > 0 & DgStockCourantDetail.Rows.Count > 0) DgStockCourantDetail.CurrentCell = DgStockCourantDetail[DgStockCourantDetail.CurrentCell.ColumnIndex, DgStockCourant.CurrentRow.Index]; } private void DgStockCourantDetail_SelectionChanged(object sender, EventArgs e) { if (DgStockCourant.Rows.Count > 0 & DgStockCourantDetail.Rows.Count > 0) DgStockCourant.CurrentCell = DgStockCourant[DgStockCourant.FirstDisplayedCell.ColumnIndex, DgStockCourantDetail.CurrentRow.Index]; }
Partager