I am supporting an C# windows applications which accepts and processes credit card. But due to new rules, I need to mask the credit card number as it's being entered. So if the first number is 4, it is visible until the next number is entered (e.g. 9), then the text box shows *9.
I thought of using maskedtextbox but then the characters are all "*" but i need to show the last character typed .
Are there any best practices for doing this? keep in mind I need those numbers and run validations before the credit card is processed and then process the credit card and store it in the database. I already have CC field in database encrypted.
Any suggestions/help would be highly appreciated.