Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Urwin - 14 Oct 2004 09:08 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.