c# - 如何在不将鼠标悬停在错误提供程序上的情况下显示错误?

标签 c# winforms errorprovider

如何在不将鼠标悬停在错误提供程序上的情况下显示错误? enter image description here

this.errorProvider1.SetError(textBox1, "This field must contain text");

最佳答案

可能不是最好的选择,但应该可行

    if (textBox1.Text == "")
    {
         ErrorProvider myerror = new ErrorProvider();
         ToolTip mytip = new ToolTip();
         myerror.SetError(textBox1, "This field must contain text");
         mytip.Show("This field must contain text", textBox1);
    }

关于c# - 如何在不将鼠标悬停在错误提供程序上的情况下显示错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18518902/

相关文章:

c# - 是否可以查询 ErrorProvider 是否设置了错误?

c# - 在 ErrorProvider 中填充顶部和底部

c# - 内存映射文件是否比命名管道更快?

时间:2019-05-17 标签:c#mysqlconnectionstring问题

c# - MVC3 : How to check recaptcha with Ajax or directly with JS?

c# - 我想比较 2 个哈希集并找出差异

ASP.NET 与 Winform

c# - Windows 窗体的可停靠自动隐藏面板控件

c# - 为什么我的 Windows 窗体按钮上缺少 Aero 视觉样式动画?