[英]How do I in code check that my DataGridView checkbox is selected. c# visual studio Windows form
I am wondering if there is a way to check that the last row is selected as this is a "Delivery / order system".我想知道是否有办法检查是否选择了最后一行,因为这是一个“送货/订购系统”。 I want to know if its selected so that I can make it output this row into my other table which is the cart.
我想知道它是否被选中,以便我可以将这一行 output 放入我的另一个表(即购物车)中。 DataGrid is called dgvForSale.
DataGrid 称为 dgvForSale。
I have just tried some of the things I have found on stack overflow but do not fully understand them to change it so that it will work on mine.我刚刚尝试了一些我在堆栈溢出上发现的东西,但没有完全理解它们来改变它,以便它可以在我的上工作。
unfortunately you didnt post any kind of code so its very hard to say.不幸的是你没有发布任何类型的代码所以很难说。 Please next time post the code.
请下次发布代码。
But maybe this can be a solution fpr your problem.但也许这可以解决您的问题。 You have to bin de checkbox with de 'isChecked' variable.
您必须使用 de 'isChecked' 变量绑定 de checkbox。
<CheckBox IsChecked="IsChecked" />
private bool _isChecked;
public bool IsChecked
{
get { return _isChecked; }
set { _isChecked = value; }
}
so i think now you can check if the checkbox is true or false.所以我认为现在您可以检查复选框是对还是错。 If this isnt a good solution for you please post your code, too.
如果这对您来说不是一个好的解决方案,请也发布您的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.