Hello all,
I have a UltraWinGrid and in it some cells have to take a positive float. Typically the value will be in the 1,000s or 10,000s and so I use a MaskInput = "99999.999"
Using the value 1234.56 as an example, the data in these cells display fine when they aren't in edit mode. However, in edit mode the display includes the PromptChar:
1234_.56_
The Infragistics knowledge base (http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10078) says that to get remove of the prompt char you set it to ' ', but this isn't removing the PromptChar it's just replacing the underscore with an empty space:
1234 .56
Which to my eyes just looks wrong and ugly.
Given that there is no equivalent of string.Empty for the char data type, and I've tried a null char ('\0' http://stackoverflow.com/questions/3670505/why-is-there-no-char-empty-like-string-empty) with no success, the question is, how can I get an the same display in edit mode as in non-edit mode i.e. 1234.56, but also have a filter to restrict the data type?
Note: If I remove the MaskInput it works fine, but then you can put in any characters you want and this data can only be positive numbers.
Hello ,
If you want to restrict the user to enters a numbers in a specific range, the you could set MinValue/MaxValue of UltraGridColumn, so if the user enters a number outside of the range, and tries to leave the cell, he will receive a message. OR you could use the following string as MaskInput “{double:5.3:c}” and to set PromptChar to ‘ ’. More information about MaskImput you could find on the following link:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.1/CLR2.0/html/Infragistics2.Win.UltraWinEditors.v12.1~Infragistics.Win.UltraWinEditors.UltraNumericEditorBase~MaskInput.html
Please let me know if you have any further questions.
This works, in so far as the PromptChar is not visible, but it means redundant decimal places are visible when not in edit mode.
For example for the value 1234
It is always displayed as 1234.000 for both edit and non-edit mode. What I'd like is for non-edit mode to be displayed as simply 1234, as in this case adding the decimal places gives you no new information.
Hello,
MaskInput property of UltraGridColumn object, is using when the editor of the column is in edit mode, Format property of UltraGridColumn is using when a cell of this column is not in edit mode. So in your case you could set Format property for this column. I have created a smalls ample in order to demonstrate you this approach. Please run the sample and let me know if this is what you are looking for.
Please let me know if you have any further questions or if I am missing something.
Thanks for that, that has resolved my issue.
For the benefit of everyone else in order to get what I wanted I needed the following applied to the column of interest:
1. and 2. deal with the display in edit mode, 3. deals with the display in non-edit mode.