首页 [汇编]maskedTextBox实例收集

[汇编]maskedTextBox实例收集

举报
开通vip

[汇编]maskedTextBox实例收集[汇编]maskedTextBox实例收集 maskedTextBox实例收集 ?????主程序文件完整程序代码????? using System; using System.Collections.Generic; using System.Windows.Forms; namespace _8_18 { static class Program { /// 本教程来自 /// 应用程序的主入口点。 /// [STAThread] static void Main() { Applica...

[汇编]maskedTextBox实例收集
[汇编]maskedTextBox实例收集 maskedTextBox实例收集 ?????主程序文件完整程序代码????? using System; using System.Collections.Generic; using System.Windows.Forms; namespace _8_18 { static class Program { /// 本教程来自 /// 应用程序的主入口点。 /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMaskedTextBox()); } } } ?????frmMaskedTextBox窗体设计文件完整程序代码网站源代 码????? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace _8_18 { public partial class frmMaskedTextBox : Form { public frmMaskedTextBox() { InitializeComponent(); } Binding currentBinding, phoneBinding; DataSet employeesTable = new DataSet(); SqlConnection sc; SqlDataAdapter dataConnect; private void frmMaskedTextBox_Load(object sender, EventArgs e) { //maskedTextBox1.Mask = "00/00/0000"; maskedTextBox1.ValidatingType = typeof(System.DateTime); } private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) { toolTip1.ToolTipTitle = "日期"; toolTip1.Show("你输入的类型不证确请输入一个日期", maskedTextBox1, 5000); } private void maskedTextBox1_TypeValidationCompleted(object sender, TypeValidationEventArgs e) { } } } ?????frmMaskedTextBox窗体代码文件完整程序代码????? namespace _8_18 { partial class frmMaskedTextBox { /// 本教程来自 /// 必需的设计器变量。 /// private System.ComponentModel.IContainer components = null; /// /// 清理所有正在使用的资源。 /// /// 如果应释放托管资源,为 true;否则为 false。 protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } /// /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // maskedTextBox1 // this.maskedTextBox1.Location = new System.Drawing.Point(34, 56); this.maskedTextBox1.Name = "maskedTextBox1"; this.maskedTextBox1.Size = new System.Drawing.Size(111, 21); this.maskedTextBox1.TabIndex = 0; this.maskedTextBox1.MaskInputRejected += new System.Windows.Forms.MaskInputRejectedEventHandler(this.maskedTextBox1_MaskInputRejected); this.maskedTextBox1.TypeValidationCompleted += new System.Windows.Forms.TypeValidationEventHandler(this.maskedTextBox1_TypeValidationCompleted); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(32, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(113, 12); this.label1.TabIndex = 1; this.label1.Text = "输入日期yyyy-mm-dd"; // // button1 // this.button1.Location = new System.Drawing.Point(34, 83); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(111, 23); this.button1.TabIndex = 2; this.button1.Text = "确定"; this.button1.UseVisualStyleBackColor = true; // // frmMaskedTextBox // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(191, 112); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.maskedTextBox1); this.Name = "frmMaskedTextBox"; this.Text = "frmMaskedTextBox"; this.Load += new System.EventHandler(this.frmMaskedTextBox_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.MaskedTextBox maskedTextBox1; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; } } 示例 MaskInputRejected事件 本示例通过在MaskInputRejected事件下编写代码,来判断用户输入的数据是否正确。示例运行结果如图2所示。网站源代码 图2 MaskInputRejected事件的使用 程序主要代码如下: private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) { toolTip1.ToolTipTitle = "日期"; toolTip1.Show("你输入的类型不证确请输入一个日期", maskedTextBox1, 5000); } 完整程序代码如下: ?????主程序文件完整程序代码????? using System; using System.Collections.Generic; using System.Windows.Forms; namespace _8_18 { static class Program { /// 本教程来自 /// 应用程序的主入口点。 /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMaskedTextBox()); } } } ?????frmMaskedTextBox窗体设计文件完整程序代码 ????? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace _8_18 { public partial class frmMaskedTextBox : Form { public frmMaskedTextBox() { InitializeComponent(); } Binding currentBinding, phoneBinding; DataSet employeesTable = new DataSet(); SqlConnection sc; SqlDataAdapter dataConnect; private void frmMaskedTextBox_Load(object sender, EventArgs e) { //maskedTextBox1.Mask = "00/00/0000"; maskedTextBox1.ValidatingType = typeof(System.DateTime); } private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) { toolTip1.ToolTipTitle = "日期"; toolTip1.Show("你输入的类型不证确请输入一个日期", maskedTextBox1, 5000);( ?????frmMaskedTextBox窗体代码文件完整程序代码 ????? namespace _8_18 { partial class frmMaskedTextBox { /// /// 必需的设计器变量。 /// private System.ComponentModel.IContainer components = null; /// /// 清理所有正在使用的资源。 /// /// 如果应释放托管资源,为 true;否 则为 false。 protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。网站源代码 /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // maskedTextBox1 // this.maskedTextBox1.Location = new System.Drawing.Point(34, 56); this.maskedTextBox1.Name = "maskedTextBox1"; this.maskedTextBox1.Size = new System.Drawing.Size(111, 21); this.maskedTextBox1.TabIndex = 0; this.maskedTextBox1.MaskInputRejected += new System.Windows.Forms.MaskInputRejectedEventHandler(this.maskedTextBox1_MaskInputRejected); this.maskedTextBox1.TypeValidationCompleted += new System.Windows.Forms.TypeValidationEventHandler(this.maskedTextBox1_TypeValidationCompleted); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(32, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(113, 12); this.label1.TabIndex = 1; this.label1.Text = "输入日期yyyy-mm-dd"; // // button1 // this.button1.Location = new System.Drawing.Point(34, 83); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(111, 23); this.button1.TabIndex = 2; this.button1.Text = "确定"; this.button1.UseVisualStyleBackColor = true; // // frmMaskedTextBox // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(191, 112); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.maskedTextBox1); this.Name = "frmMaskedTextBox"; this.Text = "frmMaskedTextBox"; this.Load += new System.EventHandler(this.frmMaskedTextBox_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.MaskedTextBox maskedTextBox1; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; } }
本文档为【[汇编]maskedTextBox实例收集】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_729658
暂无简介~
格式:doc
大小:34KB
软件:Word
页数:0
分类:企业经营
上传时间:2018-04-15
浏览量:3