kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
I have this textbox that I want it to hold this kind of text format:
"12345678" or "ABC/1234/12"
Now these are the conditions I want to validate:
1. If I start with a number, then accept only numbers and stop registering any key stroke when the length of the textbox reaches 8 characters
2. If I start the entry with a letter, then:
- The first 3 characters must be letters only
- The fourth character must be a forward slash. If I forget to add it and press a number value as shown from my sample above, then I want to add that slash before I register the pressed key.
- After the first slash, the next 4 characters are to be numbers.
- Then we repeat the second rule under point(2) above.
- We also repeat third rule under point(2) above this time for the last two characters.
3. The entry should only start with a number or a letter. I don't want to register the spacebar when pressed.
4. I will want to be able to use the delete and backspace keys to make edit. In that case, the above rules still hold valid. So when I delete one letter from the ABC, I should add or fix that letter before any further registration of keys are implemented.
Thanks in advance for reading this. I will be very glad to have a solution to this. Seems a bit complex to me to process ATM.
"12345678" or "ABC/1234/12"
Now these are the conditions I want to validate:
1. If I start with a number, then accept only numbers and stop registering any key stroke when the length of the textbox reaches 8 characters
2. If I start the entry with a letter, then:
- The first 3 characters must be letters only
- The fourth character must be a forward slash. If I forget to add it and press a number value as shown from my sample above, then I want to add that slash before I register the pressed key.
- After the first slash, the next 4 characters are to be numbers.
- Then we repeat the second rule under point(2) above.
- We also repeat third rule under point(2) above this time for the last two characters.
3. The entry should only start with a number or a letter. I don't want to register the spacebar when pressed.
4. I will want to be able to use the delete and backspace keys to make edit. In that case, the above rules still hold valid. So when I delete one letter from the ABC, I should add or fix that letter before any further registration of keys are implemented.
Thanks in advance for reading this. I will be very glad to have a solution to this. Seems a bit complex to me to process ATM.