⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 validation.cs

📁 c#标准教程适合与处于不同学习阶段的人
💻 CS
字号:
using System;
using SWF = System.Windows.Forms;

namespace BankCustomerApp
{

	public class Validation
	{

		public static void IsInteger(object sender, System.ComponentModel.CancelEventArgs e)
		{
			SWF.TextBox  txt;
			txt = (SWF.TextBox) sender;

			try
			{
				int.Parse(txt.Text);
			}
			catch(FormatException)
			{
				SWF.MessageBox.Show("Please enter a numeric value.", "Bank Customer App");
				e.Cancel = true;  // cancel validation, returns focus
			}
			catch(OverflowException)
			{
				SWF.MessageBox.Show("Please enter an integer in the range " + int.MinValue + " ... " + int.MaxValue, "Bank Customer App");
				e.Cancel = true;  // cancel validation, returns focus
			}
			catch(Exception ex)
			{
				SWF.MessageBox.Show("Unknown error: " + ex.Message, "Bank Customer App");
				e.Cancel = true;  // cancel validation, returns focus
			}
		}
	
	}//class
}//namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -