[英]VB.net Get Number of datagridview rows that are selected
I wanted to get the number of rows in the datagridview that have been selected, so that i can make sure that only one row has been selected by the user, but i cant find a solution anywhere. 我想获取datagridview中已选择的行数,这样我就可以确保用户只选择了一行,但我无法在任何地方找到解决方案。 help,please!!
请帮助!!
You can use the SelectedRows property of the DataGridView. 您可以使用DataGridView的SelectedRows属性。
Gets the collection of rows selected by the user.
获取用户选择的行集合。
However if your purpose is to enforce single select, then @LarsTech's comment to set MultiSelect = false
is better. 但是,如果您的目的是强制执行单选,那么@ LarsTech的注释设置
MultiSelect = false
会更好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.