I have a textfield which has to accept the currency. While keying in the the values, the user when he tries to enter a 3rd decimal value, it should consume. How do i do this?
Hello ! You did not say if you are using swing,AWT or SWT, anyway, I'm using SWT and I believe that basiclly this shuld be in every one of them (maybe a not excactly the same name) Anyway , use this:
( Text myText = new Text(composite,SWT.NONE) ) myText.setTextLimit(2); this will not let the user enter more that 2 digits Hope this is what you need Dave
I dont want to limit the numbers to only 2 but i want the user not to enter more than 2 decimals. For ex. the number can be 4311.22 and not 4311.222222. I want to limit the number of digits in the decimal place to 2.