Skip to main content Skip to footer

How to Define Upper and Lower Limits for C1NumericEdit

This article will explain how to set an upper and lower limit on the C1NumericEdit control.

To define an upper and lower limit on the C1NumericEdit, you can use the "PostValidation.Intervals" property. You can also use the ErrorInfo property to define what happens if the User types an invalid value. See the code below, placed inside the Form1_Load event, as an example:

//set ErrorInfo in case customer types an out of range value and tries to shift focus
c1NumericEdit1.ErrorInfo.ErrorAction = ErrorActionEnum.SetValueOnError;
c1NumericEdit1.ErrorInfo.ValueOnError = 0;
c1NumericEdit1.ErrorInfo.CanLoseFocus = true;

//add interval to define a Range
c1NumericEdit1.PostValidation.Intervals.Add(new ValueInterval(0, 1000, true, true) { UseMaxValue = true, UseMinValue = true});
c1NumericEdit1.PostValidation.ErrorMessage = "Value out of Range";

Hunter Haaf