By Ben Hayat - 6/5/2007
I have field that the user needs to enter State tax. i.e. 7.0 or 7.2 or 10.1
At first I had created the field in DDT as decimal with precision of 2.
Then when I binded that field to a textbox, it would not even work properly or accept the "." prperly
I tried with Mask TextBox and could not enter 07.12
Then I changed the DDT to SmallMoney, rebuilt the database and rebuilt my BO.
Tried it again, and I can't get to accept decimal numbers in either text box.
Question:
a) is it the field type I'm using in DDT, is wrong?
b) Or what should I set on the mask to get it to work?
Thanks!
|
By Ben Hayat - 6/5/2007
^Pump^
|
By StrataFrame Team - 6/6/2007
Both of those data types should be returned as System.Decimal. So, my first question is: if you put a break point in the 'set' of the property, do you hit the break point when you try to enter a value in the textbox? Question 2: does it work if you set the BindingFormat to "N2" (without the quotes )? Question 3: is it setting the value and just not saving off the decimal or is it not setting the value at all? Question 4: if you're reaching the breakpoint on the set, is the value correct (does it have the proper decimal value) or it is a truncated decimal (like 7 instead of 7.2)?
|
By Ben Hayat - 6/6/2007
Ben, before answering your questions, are you the questions related to TextBox or MaskedTextBox?
Each one behaves differently when the are binded to BO. If I remove the binding, the controls work fine.
There seem to be a problem, when I hit the decimal point "."
After that it acts weird.
Ben, I'm not trying not to follow/answer your questions, but I think you'll get a better experience and feedback if you try it yourself with a simple decimal field. It's very hard to describe and give you definite answers, depending on which textbox and when you enter the decimal point.
Try it and if you still can't see it, I then will start...
Thank you Sir!
|
By Ben Hayat - 6/6/2007
Ok Mr. Ben, tested more with the obvious stuff first:
a) Used the "N2" in the binding format of text box and solved the problem. However, in maskedtextbox, if you have set masked "99.99", it still goes crazy.
without further looking, I'd say it needs "BindingFormat" value.
Can you tell us the values that can be used in this field?
Thanks!
|
By StrataFrame Team - 6/6/2007
These are your possible values for the formatting:http://msdn2.microsoft.com/en-us/library/system.globalization.numberformatinfo(VS.80).aspx Also, on the MaskedTextBox, you might have to tell it to include the literals in the value. It's a property on the control, and I think it's set to exclude the literals by default.
|
By Ben Hayat - 6/6/2007
Thank you Sir!
|
|