Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 GridView,其中有可见行和不可见行,
但我只想计算该网格中的可见行
我试过这个
int rowCount = gv_SPAvailable.Rows.Count(row => row.IsVisible);
但是我无法获得,有没有其他方法,请任何人帮忙
尝试这个:
int rowCount = gv_SPAvailable.Rows.GetRowCount(DataGridViewElementStates.Visible);
这些代码也工作正常
int numVisible = 0; foreach(GridViewRow row in gv_SPAvailable.Rows) { if(row.Visible == true) { numVisible += 1; } }