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

Binding and controlling values which go into data source

P: n/a
I am trying to use data binding to avoid having to write event
handlers everywhere for my data transfer from controls to data source
and all is working well except, i have a condition i would like to
place on the value before i let it go through. I have built an
expression evaluator to determine when something is valid versus
invalid.

My problem is that when i trap the format event of the data binding, i
can get to the value before it goes into the control but what i can't
figure out is how to stop the actual value from getting there when the
eval says it is not valid.

Example:
I have a simple binding set up for a text box to go to another text
box but i only want the 2nd text boxes value to update when the first
one is alpha numeric. So in the format event i can put something like
if ce.DesiredType is GetType(String) then Return else ...
This is where i come up scratching my head. how can i essentially say
Cancel the request to send the value over. It might be something
simple i am missing but i can't find it.

Thoughts?
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Look at the validating event
-----Original Message-----
I am trying to use data binding to avoid having to write eventhandlers everywhere for my data transfer from controls to data sourceand all is working well except, i have a condition i would like toplace on the value before i let it go through. I have built anexpression evaluator to determine when something is valid versusinvalid.

My problem is that when i trap the format event of the data binding, ican get to the value before it goes into the control but what i can'tfigure out is how to stop the actual value from getting there when theeval says it is not valid.

Example:
I have a simple binding set up for a text box to go to another textbox but i only want the 2nd text boxes value to update when the firstone is alpha numeric. So in the format event i can put something likeif ce.DesiredType is GetType(String) then Return else ...
This is where i come up scratching my head. how can i essentially sayCancel the request to send the value over. It might be somethingsimple i am missing but i can't find it.

Thoughts?
.

Nov 20 '05 #2

P: n/a

There are two problems with Validate.
1) It doesn't fire until you press enter or leave the field
2) it doesn't let you get to the value BEFORE databinding occurs.
The format and parse events from the binding are the only way, that i
can tell, to get to the value before it actually gets put into the
source in question. SO validate doesn't work.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.