简体   繁体   English

C#清除datagridview中的列还会删除所有行吗?

[英]C# Clearing the columns in a datagridview also removes al the rows?

清除datagridview的列时,所有行都被删除是否有意义?

在诸如DataGridView之类的表显示中,如果没有列,则不能有任何行,反之亦然。

If you are removing all of the columns, then there can be no rows associated with them. 如果要删除所有列,那么将没有与之关联的行。 You'd need at least one column in order to have rows. 您需要至少一列才能有行。

您为什么不只是在列上切换可见性?

dgv.Columns[sColumnName].Visible

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM