Datagridview单元格验证错误标志符号 [英] Datagridview cell validating error glyph

查看:62
本文介绍了Datagridview单元格验证错误标志符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我设置了e.cancel = true 并且设置为


,那么

在我的一个窗体上进行单元格验证事件取决于标准,该字段不会跳转提前 但错误字形未显示


表单框架4.5.2


甚至 


< ; appSettings>

  &NBSP; < add key =" EnableWindowsFormsHighDpiAutoResizing"值= QUOT;真" />

< / appSettings>


已添加到app.config


errorprovider控件已添加到表单


请看一下屏幕截图


你能猜出为什么没有显示错误字形


 private void dgvtest_CellValidating(object sender,DataGridViewCellValidatingEventArgs e) 
{
if(e.RowIndex == -1)
return;
string clmname = dgvtest.Columns [e.ColumnIndex] .Name;
if(clmname.Equals(" test1"))
{
if(e.FormattedValue.ToString()。Equals(" Stop"))
{
dgvtest [clmname,e.RowIndex] .ErrorText =" Test Erro" ;;
e.Cancel = true;
返回;
}
}

}



解决方案

您好 Sushil Agarwal



根据您的问题与Winforms更相关,我会将主题移至   winforms论坛 为了获得合适的支持。



Visual C#讨论并询问C#编程语言,IDE,库,示例和工具。如果您有一些语法或代码错误,请随时与我们联系。我们会尽力为您提供解决方案。



最好的问候,



feih-7


on my one of windows form for cell validating event depending upon the criteria if i set e.cancel = true  and set as under

the field does not jump ahead  but the error glyph is not shown

the form framework 4.5.2

even the 

<appSettings>
    <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />

</appSettings>

is added to app.config

errorprovider control is added to form

please have a look at screen shot

can u guess why the error glyph is not shown

 private void dgvtest_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            if (e.RowIndex == -1)
                return;
            string clmname = dgvtest.Columns[e.ColumnIndex].Name;
            if (clmname.Equals("test1"))
            {
                if (e.FormattedValue.ToString().Equals("Stop"))
                {
                    dgvtest[clmname, e.RowIndex].ErrorText = "Test Erro";
                    e.Cancel = true;
                    return;
                }
            }

        }


解决方案

Hi Sushil Agarwal,

According to your question is more related to Winforms, I will move the thread to  winforms forum  for suitable support.

The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools . If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

Best Regards,

feih-7


这篇关于Datagridview单元格验证错误标志符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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