Hi Experts,
I want to enter double values in the textbox. For this i am using UltraNumericEditor control.
If i enter 321.2685248, it should show 321.27 to the user but the value in the control should still retain the actual value 321.2685248.
Similarly, if i enter -1234.525897, it should show -1234.52 to the user, but the value in the control should still retain actual value -1234.525897
After the decimal, it should show only upto 2 numbers to the user but still retain the actual value. Please let me know what properties of UltraNumericEditor to be set.
Hello,
Could you please review the sample attached to this post and see if it meets your requirements.
Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi, Thanks for the reply.
The sample code restricts the user to input only 3 numbers before decimal and 7 numbers after decimal point. But, i dont want this restriction. User should be able to input as many numbers as he can before and after decimal point. But, when the button is clicked, the textbox should show all the numbers before decimal and only 2 numbers after the decimal point. Please let me know how to achieve this.
Could you please review if the following code makes your application work as you expect:
this.ultraNumericEditor1.Nullable = true; this.ultraNumericEditor1.Value = null;
this.ultraNumericEditor1.Nullable = true;
this.ultraNumericEditor1.Value = null;
Please let me know if the above works for you.
Hi Boris, Thanks for the reply. This partly fixed my issue. If i enter value -123.456, click Show value button and then click inside the textbox, i see more 0s displayed after -123.456
Is there any way to just display -123.456 even after clicking inside the control?
You could try the following code for that matter:
private void ultraNumericEditor1_AfterEnterEditMode(object sender, EventArgs e) { EditorWithMask editor = (EditorWithMask)ultraNumericEditor1.Editor; editor.SetText(editor.Value.ToString()); }
Please do not hesitate to ask if something comes up.
Hi Boris, this is working. But i want the alignment of text to be proper. After i insert value, click Show value button and again put my cursor inside the control, i see space left to the right of the text. Is there any property to set the alignment so that the text appears either at complete right side or complete left side of the control but not in between?
Actually the text is aligned to right, it looks like that it is not ,because of the empty characters after the last digit. There is no way to know how many characters the end user would like to enter and this prevents you from setting the number of digits in the mask after the decimal point to something that will make the text aligned completely to the right. There could be a way to achieve the desired behavior using 'CreationFilter' but I do not recommend it to you as it will be very hard to determine how to exactly set the size of the editor in every situation.
Please do not hesitate to contact us if you need any additional assistance.