﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Catching the event that raises the Save Changes dialog</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 27 Sep 2026 01:00:48 GMT</lastBuildDate><ttl>20</ttl><item><title>Catching the event that raises the Save Changes dialog</title><link>http://forum.strataframe.net/FindPost8834.aspx</link><description>I'm using the IBusinessBindable interface to wrap the Tx Text control.  Because of something I'm doing (which is unknown at this point), every time I go to close the form with this control, I get prompted to save changed, even if all I do is open and close the form.  &lt;br&gt;
&lt;br&gt;
I put a button on the form to show me if the BO is dirty. It isn't until I close the form (i.e. I can open the form, click the button - its not dirty, then close the form - it is dirty (checked in the closing event of the form), I get the save changes dialog, cancel out to close).  So before the form closing event, something is making the BO dirty.&lt;br&gt;
&lt;br&gt;
Soooo... I'm wondering what event to handle to see what is happening as I close the form. Then I could walk through it and see what my mistake is.  I'm already handling the BeforeSave, but that doesn't work, because this happens before that event is raised.</description><pubDate>Thu, 17 May 2007 11:36:44 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Catching the event that raises the Save Changes dialog</title><link>http://forum.strataframe.net/FindPost8870.aspx</link><description>Well, I've got the cussing down.&lt;br&gt;
&lt;br&gt;
Looking at the call stack though, the only code being called is .NET code. Neither my code or any Tx Text control code is being called at all.  I was thinking this was related to validation and hoping somebody who understands it better than I could explain why validation code is setting properties?  &lt;br&gt;
&lt;br&gt;
Unless you saying that this is related to how Tx Text instantiates itself, that it adds handlers to that call this .NET code?!??  That would be just lovely  :(</description><pubDate>Thu, 17 May 2007 11:36:44 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Catching the event that raises the Save Changes dialog</title><link>http://forum.strataframe.net/FindPost8869.aspx</link><description>Well, without getting my hands on it I cannot tell you exactly what is going on within your code and control.&amp;nbsp; We use the TxTextControl in one area of our medical application and we had to write all sorts of code around it due to the nature of how that control instantiates itself.&amp;nbsp; So giving you a straight answer just isn't going to happen on this one, everytime Ihave used that TxTextControl I cuss a little....debug a lot...and write additional code to make it work....the ability to work with DOC files without requiring Word to be installed is worth the trouble, but there are some definite idiosyncrasies with their control.</description><pubDate>Thu, 17 May 2007 11:06:00 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Catching the event that raises the Save Changes dialog</title><link>http://forum.strataframe.net/FindPost8867.aspx</link><description>...which you covered in class...as I now recall. :D&lt;br&gt;
&lt;br&gt;
OK, this is apparently all being cased by Winforms validation code.  What I don't get is that it is setting property values here. I.e. the validation code is setting properties.  Any idea why?&lt;br&gt;
&lt;br&gt;
Here is some of the call stack up to the set_FormattedText:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
[quote]&gt;TxTextTest.exe!TxTextTest.TextEditorControl.set_FormattedText(String value = "...") Line 89 + 0xb bytesBasic&lt;br&gt;
 [Native to Managed Transition]&lt;br&gt;
 [Managed to Native Transition]&lt;br&gt;
 System.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(object component = {TxTextTest.TextEditorControl}, object value = "...") + 0x10c bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Binding.SetPropValue(object value) + 0xca bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Binding.PullData(bool reformat, bool force) + 0x13b bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Binding.Target_Validate(object sender, System.ComponentModel.CancelEventArgs e = {System.ComponentModel.CancelEventArgs}) + 0x1b bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Control.OnValidating(System.ComponentModel.CancelEventArgs e) + 0x4c bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Control.PerformControlValidation(bool bulkValidation = false) + 0x45 bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ValidateThroughAncestor(System.Windows.Forms.Control ancestorControl = {TxTextTest.TextEditorUIControl}, bool preventFocusChangeOnError = true) + 0xff bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ValidateInternal(bool checkAutoValidate, out bool validatedControlAllowsFocusChange) + 0x12f bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ValidateInternal(bool checkAutoValidate = true, out bool validatedControlAllowsFocusChange = false) + 0x9e bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.Validate(bool checkAutoValidate) + 0x15 bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Form.WmClose(ref System.Windows.Forms.Message m = {msg=0x10 (WM_CLOSE) hwnd=0xc081c wparam=0x0 lparam=0x0 result=0x0}) + 0x87 bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m) + 0x1d5 bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNative&amp;#119;indow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(ref System.Windows.Forms.Message m) + 0xbf bytes&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Native&amp;#119;indow.Callback(System.IntPtr hWnd, int msg = 16, System.IntPtr wparam, System.IntPtr lparam) + 0x68 bytes&lt;br&gt;
 [Native to Managed Transition]&lt;br&gt;
 [Managed to Native Transition]&lt;br&gt;
 System.Windows.Forms.dll!System.Windows.Forms.Native&amp;#119;indow.DefWndProc(ref System.Windows.Forms.Message m) + 0x43 bytes&lt;br&gt;
  ...etc. for another 20 calls or so&lt;br&gt;
  TxTextTest.exe!TxTextTest.AppMain.Main() Line 19 + 0x6 bytesBasic[/quote]&lt;br&gt;
&lt;br&gt;
So, I'm hoping you can help me understand what the heck is going on, or point me in the right direction to understand this.</description><pubDate>Thu, 17 May 2007 10:55:36 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Catching the event that raises the Save Changes dialog</title><link>http://forum.strataframe.net/FindPost8846.aspx</link><description>If you go to the Tools -&amp;gt; Options -&amp;gt; Debug&amp;nbsp;uncheck the JustMyCode setting, you'll get the code within the CallStack for the TXText control... it might give you more info as to why it thinks that the binding needs to be updated...</description><pubDate>Wed, 16 May 2007 17:02:20 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Catching the event that raises the Save Changes dialog</title><link>http://forum.strataframe.net/FindPost8844.aspx</link><description>OK, I did that and the stack trace indicated the following were called (last called on top):&lt;br&gt;
&lt;br&gt;
 Form2.BusinessBindingSource1_ListChanged2&lt;br&gt;
 [External Code]&lt;br&gt;
 CustomerNotesBO.set_cn_note&lt;br&gt;
 CustomerNotesBO.Field_cn_note_Descriptor.SetValue&lt;br&gt;
 [External Code]&lt;br&gt;
 AppMain.Main&lt;br&gt;
 [External Code]&lt;br&gt;
&lt;br&gt;
The 'set_cn_note' is were the BO is getting dirtied.  I'm wondering why it is getting called?  It isn't dirty, so why is it updating?  &lt;br&gt;
 &lt;br&gt;</description><pubDate>Wed, 16 May 2007 16:09:15 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Catching the event that raises the Save Changes dialog</title><link>http://forum.strataframe.net/FindPost8835.aspx</link><description>Drop a BusinessBindingSource on the form and set it's business object to the BO you want to watch.&amp;nbsp; Then add a handler to the BBS's ListChanged event.&amp;nbsp; It will get raised whenever a property on the business object is set.&amp;nbsp; So, put your breakpoint in that handler, and you'll be able to look at the CallStack (like in class) to see what is getting called down the line to change the data within the business object to make it dirty.</description><pubDate>Wed, 16 May 2007 14:07:14 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>