记录更改时触发的WinForms事件 [英] WinForms events that fire when the record changes

查看:91
本文介绍了记录更改时触发的WinForms事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将MS Access程序转换为C#Windows窗体。表单包含一个Datagridview,应限制为1到4个条目。在MS Access版本中,我使用"on current";在记录更改和加载表单时触发。它会在
中禁用子项中的addrow 函数。什么会等于记录指针更改时触发的事件。我需要在用户向datagridview添加行后以及记录更改时进行检查。  


 int MaxRows = 4; 
if(shiftPrintersDataGridView.Rows.Count< = MaxRows)
{
shiftPrintersDataGridView.AllowUserToAddRows = true;
}
其他
{
shiftPrintersDataGridView.AllowUserToAddRows = false;
}


 

解决方案

以下内容适合您。


https://stackoverflow.com/questions/9528573/how-to-check-if-any-row-is-added-to-datagridview


I am converting a MS Access program to C# Windows form. The form contains a Datagridview that should be limited to 1 to 4 entries. In the MS Access version I use "on current" that fires when the record changes and when the form is loaded. It will disable\enable the addrow function in the subform. What would the equal to a event that fires when the record pointer changes. I need to check after a user adds a row to the datagridview and when the record changes.  

            int MaxRows = 4;
            if (shiftPrintersDataGridView.Rows.Count <= MaxRows)
            {
                shiftPrintersDataGridView.AllowUserToAddRows = true;
            }
            else
            {
                shiftPrintersDataGridView.AllowUserToAddRows = false;
            }

 

解决方案

The following should work for you.

https://stackoverflow.com/questions/9528573/how-to-check-if-any-row-is-added-to-datagridview


这篇关于记录更改时触发的WinForms事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆