none
Difference in Verify method of MaskedTextProvider with or without decimal separator. RRS feed

  • Question

  • MaskedTextProvider's verify method responds strangely in case a decimal separator is used.
    case A) String '1' with mask '999' is approved. However:
    case B) String '1.2' with mask '999.99' is not approved. 
    case C) String '001.2' with mask '999.99' again is approved.

    I would expect case B to be approved. (Considering A and C are approved). What am I missing?

    Monday, February 24, 2014 1:27 PM

Answers

  • Hello,

    Could you please share the program you test with MaskedTextProvider? Because I made a test with which is similar with yours, however, all of them is approved.

    My test demo:

    using System;
    
    using System.Collections.Generic;
    
    using System.ComponentModel;
    
    using System.Linq;
    
    using System.Text;
    
    using System.Threading.Tasks;
    
    
    namespace TestForMaskedTextProvider
    
    {
    
        class Program
    
        {
    
            static void Main(string[] args)
    
            {
    
                string textInputByUser;
    
    
                bool isValid;
    
    
                MaskedTextProvider maskProvider;
    
    
                textInputByUser = "1";
    
    
                maskProvider = new MaskedTextProvider("999");
    
    
                maskProvider.Set(textInputByUser);
    
    
                isValid = maskProvider.MaskCompleted;
    
    
                Console.WriteLine("String '1' with mask '999' is approved:" + isValid);
    
    
                textInputByUser = "1.2";
    
    
                maskProvider = new MaskedTextProvider("1.2");
    
    
                maskProvider.Set(textInputByUser);
    
    
                isValid = maskProvider.MaskCompleted;
    
    
                Console.WriteLine(" String '1.2' with mask '999.99' is approved:" + isValid);
    
    
                textInputByUser = "001.2";
    
    
                maskProvider = new MaskedTextProvider("999.99");
    
    
                maskProvider.Set(textInputByUser);
    
    
                isValid = maskProvider.MaskCompleted;
    
    
                Console.WriteLine(" String '001.2' with mask '999.99' is approved:" + isValid);
    
    
                Console.ReadLine();
    
            }
    
        }
    
    }
    

    The result:

    I use Windows8, VS2012 and .Net Framework 4.5. You can have a try.

    If I misunderstand, please let me know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 25, 2014 2:37 AM
    Moderator