Having trouble with Mask and text field with decimal numbers


Author
Message
Ben Hayat
Ben Hayat
Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
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!

..ßen
Ben Hayat
Ben Hayat
Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
^Pump^

..ßen
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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 Wink)?  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)?
Ben Hayat
Ben Hayat
Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
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!

..ßen
Ben Hayat
Ben Hayat
Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
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!

..ßen
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.

Ben Hayat
Ben Hayat
Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)Advanced StrataFrame User (570 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
Ben Chase (06/06/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.




Thank you Sir!

..ßen
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search