StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
WinForms (How do I?)
»
MaskedTextBox
MaskedTextBox
Post Reply
Like
0
MaskedTextBox
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Larry Caylor
Larry Caylor
posted 19 Years Ago
ANSWER
Topic Details
Share Topic
Group: Awaiting Activation
Posts: 592,
Visits: 3.7K
There appears to be a problem with the MaskedTextBox. Binding a datetime field to the text box using the short date mask the results in the date 02/27/2006 being displayed as in the attached screen shot for DOB.
Attachments
MaskError.png
(
332 views,
113.00 KB
)
Reply
Like
0
StrataFrame Team
S
StrataFrame Team
posted 19 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
Howdy Larry,
I figured out your problem... .NET's data binding is just ToString()'ing the value that it's placing in the TextBox, and it's leaving off the leading 0. There's a BindingFormat property on the MaskedTextBox (right below the BindingField where you choose the field on the BO to bind to). In that BindingFormat property put this value "dd/MM/yyyy" and that should fix your problem. You can specify the format used on any binding by setting this property. It's the same as calling ToString("dd/MM/yyyy") rather than just ToString().
If you want more info on the date formats, you can go to this article within your VisualStudio help:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref2/html/M_System_DateTime_ToString.htm
(the link might also work in IE, but I'm not positive on that
)
Reply
Like
0
Larry Caylor
Larry Caylor
posted 19 Years Ago
ANSWER
Post Details
Share Post
Group: Awaiting Activation
Posts: 592,
Visits: 3.7K
Thanks Ben, that fixed the problem. I was looking at the "Mask" property and didn't even notice "BindingFormat".
-Larry
Reply
Like
0
StrataFrame Team
S
StrataFrame Team
posted 19 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
I never use the BindingFormat property, but I knew I exposed it for a reason, now I know why
Reply
Like
0
Keith Chisarik
Keith Chisarik
posted 19 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Users
Posts: 939,
Visits: 40K
Great post! I was going nutz on this issue, glad it wasnt just me.
Also, can we get the default BindingUpdateMode changed from OnValidation to OnPropertyChanged for MaskedTextBox control?
Thanks
Keith Chisarik
Sigma Data Systems
Reply
Like
0
Trent Taylor
Trent Taylor
posted 19 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
Also, can we get the default BindingUpdateMode changed from OnValidation to OnPropertyChanged for MaskedTextBox control?
Done.
This will be in the next release.
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search