ErrorProvider example and solution to remove error icon
2012-10-26 15:14
344 查看
Refer to http://stackoverflow.com/questions/7936438/errorprovider-using-class public partial class Form1 : Form { public Form1() { InitializeComponent(); } private readonly ErrorProvider errorProvider1 = new ErrorProvider(); private void textBox1_TextChanged(object sender, EventArgs e) { string text = textBox1.Text; bool hasDigit = false; foreach (char letter in text) { if (char.IsDigit(letter)) { hasDigit = true; break; } } // Call SetError or Clear on the ErrorProvider. if (!hasDigit) { errorProvider1.SetError(textBox1, "Needs to contain a digit"); } else { Icon i = errorProvider1.Icon; errorProvider1.SetError(textBox1, ""); i = errorProvider1.Icon; } } }
相关文章推荐
- SSH: Agent Admitted Failure To Sign Using The Key Error And Solution
- Apache Address already in use: make_sock: could not bind to port 80 or 443 error and solution
- 运行app,报“The connection to adb is down, and a severe error has occured.”错误
- How to silently and remotely remove Symantec Antivirus
- How to resolve the SQL error “cannot connect to WMI provider”
- How to Calculate IP/TCP/UDP Checksum–Part 3 Usage Example and Validation
- linux 解决 Linux: /usr/bin/ld: cannot find -lc Error and Solution
- The connection to adb is down, and a severe error has occured.
- The connection to adb is down, and a severe error has occured.
- magento sitemap cms page remove home and generate sitemap error
- The connection to adb is down, and a severe error has occured.
- This solution contains no resources scoped for a Web application and cannot be deployed to a .....
- ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing
- 关于android:The connection to adb is down, and a severe error has occured.
- docker rm -f Error response from daemon: Driver overlay failed to remove root filesystem
- The connection to adb is down, and a severe error has occured
- The connection to adb is down, and a severe error has occured
- android中遇到The connection to adb is down, and a severe error has occured.
- the connecftion to adb is down and a severe error has occured
- 问题解决The connection to adb is down, and a severe error has occured.