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
Sijin Joseph - 14 Oct 2004 09:43 GMT
Are you sure the data is getting commited to rdDocument.Name property
without the Parse event getting called. That would be strange indeed.
You may also try calling
teName.DataBindings["Text"].BindingManagerBase.EndCurrentEdit();
incase you are setting the text directly from code.
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
> I'm using C# and having problems getting the 'Parse' EventHandler of
> my binding object to be called. Interestingly, the 'Format' method is
[quoted text clipped - 22 lines]
> be called? Help!
> Rich