Parse method never called when data binding from class property to textedit

R

Richard Urwin

I'm using C# and having problems getting the 'Parse' EventHandler of
my binding object to be called. Interestingly, the 'Format' method is
always called however. A code snippet:

(rdDocument is a private member field of the class and has a
string-type property called 'Name')

Binding bName = new Binding("Text", rdDocument, "Name");
bName.Format += new ConvertEventHandler(teName_Format);
bName.Parse += new ConvertEventHandler(teName_Validate);
textBox1.DataBindings.Add(bName);

private void teName_Format(object sender, ConvertEventArgs e)
{
<perform formatting, OK: method always called>
}

private void teName_Validate(object sender, ConvertEventArgs e)
{
string sValue = (string) e.Value;
<perform validation, PROBLEM: method never called>
}

Can anybody tell me why it's not being called or how I can force it to
be called? Help!
Rich
 

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

Similar Threads


Top