Compare commits

..

2 Commits

Author SHA1 Message Date
nodyang@aliyun.com ea4d400eab demo 5 days ago
nodyang@aliyun.com 61c30d2bd7 currentFirstVisibleRowIndex >= 0 && currentFirstVisibleRowIndex < dataGridView2.Rows.Count 5 days ago

@ -74,11 +74,19 @@ namespace RfidWeb.Frm
} }
this.Invoke(() => this.Invoke(() =>
{ {
int currentFirstVisibleRowIndex = dataGridView1.FirstDisplayedScrollingRowIndex; try
this.dataGridView1.DataSource = lsList;
if (currentFirstVisibleRowIndex > 0)
{ {
dataGridView1.FirstDisplayedScrollingRowIndex = currentFirstVisibleRowIndex; int currentFirstVisibleRowIndex = dataGridView1.FirstDisplayedScrollingRowIndex;
this.dataGridView1.DataSource = lsList;
if (currentFirstVisibleRowIndex >= 0 && currentFirstVisibleRowIndex < dataGridView1.Rows.Count)
{
dataGridView1.FirstDisplayedScrollingRowIndex = currentFirstVisibleRowIndex;
}
}
catch (Exception e)
{
Console.WriteLine(e);
} }
}); });
} }
@ -99,11 +107,18 @@ namespace RfidWeb.Frm
} }
this.Invoke(() => this.Invoke(() =>
{ {
int currentFirstVisibleRowIndex = dataGridView2.FirstDisplayedScrollingRowIndex; try
this.dataGridView2.DataSource = lsList; {
if (currentFirstVisibleRowIndex > 0) int currentFirstVisibleRowIndex = dataGridView2.FirstDisplayedScrollingRowIndex;
this.dataGridView2.DataSource = lsList;
if (currentFirstVisibleRowIndex >= 0 && currentFirstVisibleRowIndex < dataGridView2.Rows.Count)
{
dataGridView2.FirstDisplayedScrollingRowIndex = currentFirstVisibleRowIndex;
}
}
catch (Exception e)
{ {
dataGridView2.FirstDisplayedScrollingRowIndex = currentFirstVisibleRowIndex; Console.WriteLine(e.Message);
} }
}); });
} }

Loading…
Cancel
Save