问题标签 [errorprovider]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - 使用 ErrorProvider 组件在 WinForms 中进行数据验证
我是 WinForms 的新手,并且有一个基本表单,用户可以在其中向 TextBox 输入数据,并且可以按“保存”或“取消”。我想实现数据验证以确保用户实际上在 TextBox 中输入了一些内容,但截至目前,ErrorProvider 图标仅在单击 TextBox 本身时出现,并且在按下“保存”按钮时不检查验证,如我是故意的。我也在使用 Visual Studio 2013。
此事件处理程序代码在btnSave_Click
方法中:
该txtNote_Validating
方法如下所示:
此外,我没有在我的属性窗口中添加任何事件,并且在属性窗口中的我的 btnSave 事件中txtNote
添加了一个验证事件:txtNote_Validating
和 Click :。btnSave_Click
我的问题是为什么我的 TextBox 仅在我单击它时才进行验证,以及如何使我的“保存”按钮检查 TextBox 与 ErrorProvider 组件的验证?
c# - C# 通过填写简单的注册表单显示错误消息
我是 C# 的新手,我学了一年的 C 编程。
我创建了一个窗口表单,要求用户填写注册表。
当未填写字段或未充分使用字段时,我想在按钮下方显示错误消息。
我使用了这个基本代码:
是否有任何优雅或优化的方法可以正确地做到这一点?我找到了一些错误提供程序,但显然错误提供程序打开了一个弹出窗口,我只想要“按钮下方的红色错误消息”。
你能给我一些帮助吗?:)
asp.net - Validation in different Tabs of windows form using ErrorProviders
I am working on a windows Forms Application and trying to validate few textboxes using errorproviders but the problem is when I am clicking on a button present in Tab 1, all the textboxes even present on a different tabs gets validated. I want the validation to occur for textboxes present on the current tab and not on any control present on any other tab. How can I achieve this? Please help. Below is the code related to validation in the click event.
Below is code used for validating and validated event for one textbox. I am using similar code for other textboxes as well present on other tabs.
c# - 带有自定义 GetHashCode 的 ErrorProvider
我有一个负责创建(和保存)新患者的表格。在此表单上,我使用 ErrorProvider 在无效字段上显示错误图标(在本例中为“LastName”)。所以,像往常一样 => errorProvider.DataSource = patient;
当我的模型使用默认的 GetHashCode() 时,一切正常。但是,当我尝试使用自定义哈希码(我想将此模型与 ISet 集合一起使用)覆盖此方法时,控件无法正常工作。现在,我知道自定义哈希码应该只用于不可变对象。但关键是,如果 ErrorProvider 行为依赖于 GetHashCode 以正常工作,我该如何填写这些对象的字段?是否有必要实现在默认哈希码(在对象初始化期间)和自定义哈希之间切换的脏机制?
代码示例:
c# - 使用 this.validateChildren() 时,如何针对所有无效的表单控件设置 errorProvider?
抱歉,如果我在这里忽略了一些明显的东西。
问题背景
我有一个允许用户填写表格的应用程序,其内容将上传到数据库。当他们点击“上传”按钮时,必须验证表单。如果任何字段无效,用户将收到警报。
当前解决方案
当用户点击按钮上传交易时,validFormSelections()
被调用。
对于每个组合框,都会调用验证方法,例如
问题
我想做的是在所有无效字段errorProvider
旁边显示下一个,但是目前由于在单个验证方法中,那么(如果我的理解是正确的)它不会在第一个无效字段后继续验证其他字段被发现。e.Cancel = true;
我怎样才能做到这一点,以便我可以调用this.validateChildren()
并仍然errorProvider
在所有无效字段旁边显示一个?
迄今为止尝试研究解决方案
据我了解,我的问题是需要将
CancelEventArgs
'Cancel
属性设置为 true,因为它会“切断”其余的验证。因此,最好找到一种方法来避免在以后设置此属性或找到解决此问题的方法。但我不知道该怎么做。我最初的想法之一是,只要我可以
boolean
从每个验证事件处理程序中返回一个,我就可以相当容易地解决这个问题(但是我怀疑并且后来了解到我不能这样做)。我看到在事件处理程序中返回值的替代方法是传入一个可变值(例如,CancelEventArgs
它本身)。这似乎可能是一个合适的解决方案,但是我不确定我自己如何做到这一点......
vb.net - VB.NET 2012, how to make ErrorProvider's message stay visible?
Does anyone know how to make the ErrorProvider's message stay visible when the mouse is over the ErrorProvider's icon? The message goes away or becomes not visible after a few seconds. People are complaining that there isn't enough time to read the message and they have to move the mouse away then back onto to the icon to see the message again.
Edit: Tried Steve's suggestion (below) but the message still goes away
This link Set ErrorProvider ToolTip Duration asks the exact same question I'm trying to ask here, unfortunately the question in the link is unanswered too.
c# - C# WPF 如何将文本框周围的红色矩形更改为带感叹号的红色圆圈
我有一个TextBox
连接到类属性的。
类的属性
}
由于该属性不可为空,因此有两种效果。开头有“0.00”,TextBox
如果TextBox
不满足,文本框周围会出现一个红色矩形。
现在问题
什么TextBox
属性负责这个矩形(如果存在)?听说有ErrorProvider
。是否可以在 XAML 标签中使用它来获取异常并将矩形更改为带有感叹号的红色圆圈?
vb.net - 数据绑定 ErrorProvider 不闪烁
我的表单上有一个错误提供程序,它的数据源绑定到我的记录类中的错误集合:
验证按我的预期工作,但是我的表单控件旁边没有出现红色闪烁图标。我的记录实现了 IDataErrorInfo:
任何想法都会非常感激,因为我完全被卡住了。
errorprovider - 如何设置errorprovider图标离开控件?
我想,设置“错误提供者”图标离开文本框或组合框?!我试过这段代码。但是功能说错了!
errorProvider1.GetIconAlignment(errorProvider1,ErrorIconAlignment.MiddleLeft); errorProvider1.SetError(textBox1 , "不能为空");
windows - Powershell 错误提供程序 BlinkStyle
我可能要疯了,但我似乎无法弄清楚如何在 Powershell 中的 ErrorProvider 上设置闪烁率。
错误提供程序定义为:
我尝试了各种不同的版本:
或者
没有成功!
这是我的第一个带有一些 Windows 窗体元素的 PS,所以我仍在摸索。