Binding and controlling values which go into data source

T

Tubs

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?
 
T

Troy Stauffer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top