By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,667 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,667 IT Pros & Developers. It's quick & easy.

Problem Updatinh Databound TextBox when Underlying Property Changes

P: n/a
Hello:

We have a class with a DateTime property and a string property that
represent that same date. We bind our text boxes to the string
property. We do this so that our users can enter dates in various
formats.

Inside the string property we verify the date format and conditionally
set the DateTime property.

Additionally, we have the getter of the string property format the
date.

The problem is that the unformatted text remains in the text box. We
are expecting the formatted string to appear after the user tabs away.
We have tried setting the type of binding to be OnPropertyChanged, but
this doesn't work.

We are not sure how to tell the interface to refresh. I also get the
feeling that we are not utilizing one of Windows Forms' built-in
features.

Please let me know if a string property is not the way to go. I would
much rather do things in a standard fashion. Any suggestions would be
appreciated.

Thanks,
Travis
Jul 7 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
je**********@gmail.com skrev:
Hello:

We have a class with a DateTime property and a string property that
represent that same date. We bind our text boxes to the string
property. We do this so that our users can enter dates in various
formats.

Inside the string property we verify the date format and conditionally
set the DateTime property.

Additionally, we have the getter of the string property format the
date.

The problem is that the unformatted text remains in the text box. We
are expecting the formatted string to appear after the user tabs away.
We have tried setting the type of binding to be OnPropertyChanged, but
this doesn't work.

We are not sure how to tell the interface to refresh. I also get the
feeling that we are not utilizing one of Windows Forms' built-in
features.

Please let me know if a string property is not the way to go. I would
much rather do things in a standard fashion. Any suggestions would be
appreciated.
Isn't it better use a DateTimePicker instead of a TextBox to avoid all
kind of errors that a user can do by manually enter a date?

--
Bjørn Brox
Jul 7 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.