当前位置: 首页>>代码示例>>C#>>正文


C# ErrorProvider.Clear方法代码示例

本文整理汇总了C#中System.Windows.Forms.ErrorProvider.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorProvider.Clear方法的具体用法?C# ErrorProvider.Clear怎么用?C# ErrorProvider.Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ErrorProvider的用法示例。


在下文中一共展示了ErrorProvider.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegexCheck

 public static void RegexCheck(Control checkControl, ErrorProvider errorProvider, string regexStr, CancelEventArgs e)
 {
     if (!Regex.IsMatch(checkControl.Text, regexStr)) {
         e.Cancel = true;
         errorProvider.SetError(checkControl, "格式不正确!");
     } else {
         errorProvider.Clear();
     }
 }
开发者ID:0811112150,项目名称:HappyDayHistory,代码行数:9,代码来源:ControlDataCheckHelper.cs

示例2: NotNullCheck

 public static void NotNullCheck(Control checkControl, ErrorProvider errorProvider, CancelEventArgs e)
 {
     if (string.IsNullOrEmpty(checkControl.Text)) {
         e.Cancel = true;
         errorProvider.SetError(checkControl, "不能为空!");
     } else {
         errorProvider.Clear();
     }
 }
开发者ID:0811112150,项目名称:HappyDayHistory,代码行数:9,代码来源:ControlDataCheckHelper.cs

示例3: IntCheck

 public static void IntCheck(Control checkControl, ErrorProvider errorProvider, CancelEventArgs e)
 {
     int result;
     if (!string.IsNullOrEmpty(checkControl.Text) && !int.TryParse(checkControl.Text, out result)) {
         e.Cancel = true;
         errorProvider.SetError(checkControl, "请输入数字!");
     } else {
         errorProvider.Clear();
     }
 }
开发者ID:0811112150,项目名称:HappyDayHistory,代码行数:10,代码来源:ControlDataCheckHelper.cs

示例4: RequiredCheck

 public static bool RequiredCheck(ErrorProvider errorProvider, params Control[] controls)
 {
     errorProvider.Clear();
     foreach (var control in controls) {
         if (control.Text == String.Empty) {
             errorProvider.SetError(control, "Input perlu diisi");
             return false;
         }
     }
     return true;
 }
开发者ID:rwinzhang,项目名称:Muse,代码行数:11,代码来源:Utility.cs

示例5: isNumeric

 public static void isNumeric(ErrorProvider epMain, object sender, KeyPressEventArgs e)
 {
     if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) &&
     (e.KeyChar != '.'))
     {
         epMain.SetError((Control)sender, Numeric);
         e.Handled = true;
     }
     else
     {
         epMain.Clear();
     }
 }
开发者ID:sajjucode,项目名称:programmermate,代码行数:13,代码来源:Validations.cs

示例6: isReqired

    public static bool isReqired(DevExpress.XtraEditors.TextEdit textbox, string name, ErrorProvider Errorprovider)
	{
		if (string.IsNullOrEmpty(textbox.Text)) {
			//MessageBox.Show(name & " is a requierd field", "Entry error", MessageBoxButtons.OK, MessageBoxIcon.Error)
			Errorprovider.SetError(textbox, "This is a required");
			MessageBox.Show(name + " is a requierd field", "Entry error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			textbox.Select();
			return false;
		} else {
            Errorprovider.Clear();
			return true;
			
		}

	}
开发者ID:nuwanprabath,项目名称:ITRACK,代码行数:15,代码来源:Validator.cs

示例7: SetError

        public void SetError(ErrorProvider provider , Control control, string message)
        {
            if (!string.IsNullOrEmpty(message))
            {
                if (provider.GetError(control) != "")
                {
                    provider.Clear();
                    Counter--;

                }
                else
                {
                    provider.SetError(control,message);
                    Counter ++;
                }
            }
        }
开发者ID:fadeI,项目名称:GmailReader,代码行数:17,代码来源:ErrorProviderWithCount.cs

示例8: Buscarbutton_Click

 private void Buscarbutton_Click(object sender, EventArgs e)
 {
     Rutas ruta = new Rutas();
     if (RutaIdtextBox.TextLength == 0)
     {
         ErrorProvider error = new ErrorProvider();
         error.Clear();
         error.SetError(RutaIdtextBox, "Debe especificar el id");
     }
     else
     {
         int id;
         int.TryParse(RutaIdtextBox.Text, out id);
         ruta.Buscar(id);
         RutaIdtextBox.Text = ruta.RutaId.ToString();
         NombreRutatextBox.Text = ruta.NombreRuta.ToString();
         RutaDetalletextBox.Text = ruta.Detalle.ToString();
         //CobradordataGridView.Text = CobradorIdcomboBox;
     }
 }
开发者ID:deninson18,项目名称:Lending-System,代码行数:20,代码来源:RegistroRutas.cs

示例9: DecCalendar

        /// <summary>
        /// pnl : 整個課表的 container
        /// schType : 課表類型
        /// 
        /// </summary>
        /// <param name="pnl"></param>
        /// <param name="schType"></param>
        public DecCalendar(DevComponents.DotNetBar.PanelEx pnl)
        {
            pnl.Tag = this;

            #region 註冊事件
            CalendarEvents.ReplaceEvent += (sender, e) => UpdateContent();
            CalendarEvents.ExchangeEvent += (sender, e) =>
            {
                this.SelectedCalendars = new List<CalendarRecord>();
                UpdateContent();
            };
            CalendarEvents.WeekChangeEvent += (vsender, ve) =>
            {
                if (ve.Type.Equals(this.Type) &&
                    ve.AssocID.Equals(this.AssocID))
                {
                    this.SelectedCalendars = new List<CalendarRecord>();
                    this.UpdateContent();
                }
            };
            CalendarEvents.WeekdayPeriodChangeEvent += CalendarEvents_WeekdayPeriodChangeEvent;
            #endregion

            #region 建立元件
            pnl.Controls.Clear();

            PanelEx pnlCalendarControl = makePanel(string.Empty, string.Empty, new Point(), new Size(10,50));
            pnlCalendarControl.Dock = DockStyle.Top;

            btnPrevious = CreateButton(new Size(50, 25));
            btnNext = CreateButton(new Size(50, 25));

            btnPrevious.Text = "上週";
            btnPrevious.Location = new Point(10, 10);
            btnPrevious.Click += (sender, e) =>
            {
                SchoolYearSemesterOption.Instance.StartDate = SchoolYearSemesterOption.Instance.StartDate.AddDays(-7);
                SchoolYearSemesterOption.Instance.EndDate = SchoolYearSemesterOption.Instance.EndDate.AddDays(-7);
                CalendarEvents.RaiseWeekChangeEvent(this.Type,this.AssocID);
            };

            btnNext.Text = "下週";
            btnNext.Location = new Point(70, 10);
            btnNext.Click += (sender, e) =>
            {
                SchoolYearSemesterOption.Instance.StartDate = SchoolYearSemesterOption.Instance.StartDate.AddDays(7);
                SchoolYearSemesterOption.Instance.EndDate = SchoolYearSemesterOption.Instance.EndDate.AddDays(7);
                CalendarEvents.RaiseWeekChangeEvent(this.Type,this.AssocID);
            };

            btnCurrent = CreateButton(new Size(50, 25));
            btnCurrent.Text = "本週";
            btnCurrent.Location = new Point(130, 10);
            btnCurrent.Click += (sender,e)=>
            {
                SchoolYearSemesterOption.Instance.StartDate = DateTime.Now.StartOfWeek(DayOfWeek.Monday).ToDayStart();
                SchoolYearSemesterOption.Instance.EndDate = SchoolYearSemesterOption.Instance.StartDate.AddDays(6);
                CalendarEvents.RaiseWeekChangeEvent(this.Type,this.AssocID);
            };

            ButtonX btnPrint = CreateButton(new Size(50, 25));
            btnPrint.Location = new Point(190,10);
            btnPrint.Text = "列印";
            btnPrint.Click += (sender,e)=>
            {
                if (this.Type.Equals(CalendarType.Teacher))
                {
                    List<CalendarRecord> QueryResult = new List<CalendarRecord>();

                    DateTime dteStart = SchoolYearSemesterOption.Instance.StartDate;
                    DateTime dteEnd = SchoolYearSemesterOption.Instance.EndDate;
                    List<string> SelectedClassNames = new List<string>();
                    List<string> SelectedTeacherNames = new List<string>(){AssocID};

                    BackgroundWorker worker = new BackgroundWorker();

                    worker.DoWork += (vsender, ve) =>
                    {
                        #region 找出調課記錄
                        List<CalendarRecord> ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null,
                        null, null, null, null, null);

                        List<CalendarRecord> ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null);

                        Dictionary<string, CalendarRecord> Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

//.........这里部分代码省略.........
开发者ID:KunHsiang,项目名称:ischedulePlus,代码行数:101,代码来源:DecCalendar.cs

示例10: MethodClear

		public void MethodClear ()
		{
			Form myForm = new Form ();
			myForm.ShowInTaskbar = false;
			Label label1 = new Label ();
			Label label2 = new Label ();
			ErrorProvider myErrorProvider = new ErrorProvider ();

			myErrorProvider.SetError (label1, "ErrorMsg1");
			myErrorProvider.SetError (label2, "ErrorMsg2");
			
			Assert.AreEqual ("ErrorMsg1", myErrorProvider.GetError (label1), "#1");
			Assert.AreEqual ("ErrorMsg2", myErrorProvider.GetError (label2), "#2");
			
			myErrorProvider.Clear ();

			Assert.AreEqual (string.Empty, myErrorProvider.GetError (label1), "#3");
			Assert.AreEqual (string.Empty, myErrorProvider.GetError (label2), "#4");
			
			myForm.Dispose ();
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:21,代码来源:ErrorProviderTest.cs

示例11: VerificarNoVacios

        public static void VerificarNoVacios(object sender, CancelEventArgs e, ErrorProvider error)
        {
            if (sender is TextBox)
            {
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
                {
                    error.SetError(((TextBox)sender), !string.IsNullOrEmpty(((TextBox)sender).Text) ? string.Empty : "Campo Obligatorio");
                    e.Cancel = true;
                }
                else
                {
                    error.SetError(((TextBox)sender), "");
                }
                return;
            }

            if (sender is NumericUpDown)
            {
                if (string.IsNullOrEmpty(((NumericUpDown)sender).Text))
                {
                    error.SetError(((NumericUpDown)sender), !string.IsNullOrEmpty(((NumericUpDown)sender).Text) ? string.Empty : "Campo Obligatorio");
                    e.Cancel = true;
                }
                else
                {
                    error.Clear();
                }
                return;
            }

            if (sender is ComboBox)
            {
                if (((ComboBox)sender).Items.Count <= 0)
                {
                    error.SetError(((ComboBox)sender), (((ComboBox)sender).Items.Count > 0) ? string.Empty : "Campo Obligatorio");
                    e.Cancel = true;
                }
                else
                {
                    error.Clear();
                }
                return;
            }
        }
开发者ID:seansa,项目名称:Biometrico,代码行数:44,代码来源:Validacion.cs

示例12: validateReset

 public void validateReset(ErrorProvider err)
 {
     err.Clear();
 }
开发者ID:rurth05,项目名称:TunggalJaya,代码行数:4,代码来源:Validasi.cs

示例13: ClearErrorProvider

 private void ClearErrorProvider(ErrorProvider activeErrorProvider, ToolTip activeToolTip)
 {
     activeErrorProvider.Clear();
     activeToolTip.RemoveAll();
 }
开发者ID:JamisonHarris,项目名称:TurboscanNG,代码行数:5,代码来源:IndexPanel.cs

示例14: VAL_checkRange

 private void VAL_checkRange(TextBox box, double min, double max, ErrorProvider err, out double y)
 {
     if (VAL_isRangeNum(box.Text, min, max, out y))
     {
         // clear error
         err.Clear();
     }
     else
     {
         // raise error
         err.SetError(box,
             String.Format("Must be a number between {0:f2} and {1:f2}.",
             min, max));
     }
 }
开发者ID:sv99,项目名称:DVSDK,代码行数:15,代码来源:MainForm.cs

示例15: VAL_checkLpscBox

        private void VAL_checkLpscBox(TextBox box, ErrorProvider err, out int[] storage, int lpscNum)
        {
            char[] numSeparators = { ';' };
            int min, max;

            if (lpscNum == 0)
            {
                min = (int)Consts.LpscDomain.min0;
                max = (int)Consts.LpscDomain.max0;
            }
            else if (lpscNum == 1)
            {
                min = (int)Consts.LpscDomain.min1;
                max = (int)Consts.LpscDomain.max1;
            }
            else
            {
                // invalid
                min = 2;
                max = 1;
            }

            // clear error
            err.Clear();

            // break up text into ; separated strings
            String[] domain = box.Text.Split(numSeparators, StringSplitOptions.RemoveEmptyEntries);
            int domainCnt = domain.Length;

            // create new array to store power domains
            storage = new int[domainCnt];

            // abort if no numbers
            if (domainCnt < 1) return;

            // validate substrings (numeric)
            for (int i = 0; i < domainCnt; i++)
            {
                if (VAL_isRangeNum(domain[i], min, max, out storage[i]))
                {
                    // VAL_isRangeNum saves domain number to array
                }
                else
                {
                    // raise error
                    err.SetError(box, String.Format(
                        "Must list LPSC numbers between {0} and {1} separated by \';\'",
                        min, max));

                    break;
                }
            }
        }
开发者ID:sv99,项目名称:DVSDK,代码行数:53,代码来源:MainForm.cs


注:本文中的System.Windows.Forms.ErrorProvider.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。