Hello NG, VS 2003 / VB.NET / SQL-Server-Windows-App: On a Windows-Form are some Textboxes and Combos and so on, and 2 Richttextboxes. All these are bound to the Dataset: Databinding.Add(new Binding("Text", ...)) or, if it is a Richtextbox: ....(new Binding("Rtf", ...) Now, after the User has edited anything and leaves the Record, I want to ask him "Do you want to save your changes?" So, I check if myDataSet.HasChanges. If it has no Changes, the record can be left immediately. If it has, the "Do you want to..."-Message is popping up. If the Richtextboxes-Binding is with the "Text"-Property, everything works fine. But if I use the "Rtf"-Property for the Binding, the Dataset tells me always, HasChanges is True, even if it's not! Since I need the formatting-possibilities and need to save it in the database, how could I solve this issue? Any ideas? I would be glad. Thank you! Liz
That's because there is no RtfChanged event; the only way that the binding class can know when the property has changed is if it finds an event that matches the property name plus changed. If it doesn't find one, it will always assume it to be dirty. [quoted text, click to view] "Liz Helmecke" <L-punkt-helmecke@subnet7-punkt-de> wrote in message news:%234lwBjJcEHA.2944@TK2MSFTNGP11.phx.gbl... > Hello NG, > > VS 2003 / VB.NET / SQL-Server-Windows-App: > > On a Windows-Form are some Textboxes and Combos and so on, and 2 > Richttextboxes. > All these are bound to the Dataset: > Databinding.Add(new Binding("Text", ...)) or, if it is a Richtextbox: > ...(new Binding("Rtf", ...) > > Now, after the User has edited anything and leaves the Record, I want to ask > him "Do you want to save your changes?" > So, I check if myDataSet.HasChanges. > If it has no Changes, the record can be left immediately. If it has, the "Do > you want to..."-Message is popping up. > > If the Richtextboxes-Binding is with the "Text"-Property, everything works > fine. > But if I use the "Rtf"-Property for the Binding, the Dataset tells me > always, HasChanges is True, even if it's not! > > Since I need the formatting-possibilities and need to save it in the > database, how could I solve this issue? > > Any ideas? I would be glad. > Thank you! > Liz > >
Thank you, Andrew, for this explanation! Now I understand WHY it is this way. Alright, so we have to use the Modified-Property of each control instead, not the HasChanges-Property of the Dataset. By the way, nice to get the explanation from an Infragistics-Man! We are working with infragistics-Controls right now, and are pretty glad with them most of the time, but often it is hard to understand how they work. Does Infragistics have an RTF-Control? We didn't find one. Is there a Newsgroup like this one to place questions and answers about Infragistics Controls / Netadvantage Suite? Thank you Liz
Glad I could help explain the problem. No, Infragistics doesn't have an rtf control. With regards to infragistics newsgroups, yes, there are several depending upon which control you are using. There's a list on the website: http://devcenter.infragistics.com/DevCom/NewsGroups.Aspx [quoted text, click to view] "Liz Helmecke" <L-punkt-helmecke@subnet7-punkt-de> wrote in message news:uK0AVeucEHA.2908@TK2MSFTNGP10.phx.gbl... > Thank you, Andrew, > > for this explanation! > Now I understand WHY it is this way. > Alright, so we have to use the Modified-Property of each control instead, > not the HasChanges-Property of the Dataset. > > By the way, nice to get the explanation from an Infragistics-Man! > We are working with infragistics-Controls right now, and are pretty glad > with them most of the time, but often it is hard to understand how they > work. > Does Infragistics have an RTF-Control? We didn't find one. > > Is there a Newsgroup like this one to place questions and answers about > Infragistics Controls / Netadvantage Suite? > > Thank you > Liz > >
The issue with this is knowing when to invoke the event. You may be able to get away with deriving from the RichTextBox, adding an RtfChanged event, then override OnTextChanged method and after/before calling the base implementation, raise the RtfChanged event. That presupposes that a text changed event will fire even if the rtf markup is changed (e.g. changing the selection's font); if it doesn't you may need to override the WndProc (which will mean this will require unmanaged code rights) and try using the various richtext specific messages - e.g. EM_SETPARAFORMAT. [quoted text, click to view] "Gilles E." <GillesEchegut__*at*__netcourrier.com> wrote in message news:u1dipXjdEHA.1604@TK2MSFTNGP11.phx.gbl... > Hello, > > Many thanks for this question and this good answer. I was searching for it > since a long time. > Would it be possible to create a class inherited from RichTextBox with a > RtfChanged event ? How would it be ? > > Gilles > > "Andrew Smith (Infragistics)" <productmanager@infragistics.com> schrieb im > Newsbeitrag news:uEockqlcEHA.2268@TK2MSFTNGP12.phx.gbl... > > That's because there is no RtfChanged event; the only way that the binding > > class can know when the property has changed is if it finds an event that > > matches the property name plus changed. If it doesn't find one, it will > > always assume it to be dirty. > > > > "Liz Helmecke" <L-punkt-helmecke@subnet7-punkt-de> wrote in message > > news:%234lwBjJcEHA.2944@TK2MSFTNGP11.phx.gbl... > > > Hello NG, > > > > > > VS 2003 / VB.NET / SQL-Server-Windows-App: > > > > > > On a Windows-Form are some Textboxes and Combos and so on, and 2 > > > Richttextboxes. > > > All these are bound to the Dataset: > > > Databinding.Add(new Binding("Text", ...)) or, if it is a Richtextbox: > > > ...(new Binding("Rtf", ...) > > > > > > Now, after the User has edited anything and leaves the Record, I want to > > ask > > > him "Do you want to save your changes?" > > > So, I check if myDataSet.HasChanges. > > > If it has no Changes, the record can be left immediately. If it has, the > > "Do > > > you want to..."-Message is popping up. > > > > > > If the Richtextboxes-Binding is with the "Text"-Property, everything > > works > > > fine. > > > But if I use the "Rtf"-Property for the Binding, the Dataset tells me > > > always, HasChanges is True, even if it's not! > > > > > > Since I need the formatting-possibilities and need to save it in the > > > database, how could I solve this issue? > > > > > > Any ideas? I would be glad. > > > Thank you! > > > Liz > > > > > > > > > > > >
Hello, Many thanks for this question and this good answer. I was searching for it since a long time. Would it be possible to create a class inherited from RichTextBox with a RtfChanged event ? How would it be ? Gilles "Andrew Smith (Infragistics)" <productmanager@infragistics.com> schrieb im Newsbeitrag news:uEockqlcEHA.2268@TK2MSFTNGP12.phx.gbl... [quoted text, click to view] > That's because there is no RtfChanged event; the only way that the binding > class can know when the property has changed is if it finds an event that > matches the property name plus changed. If it doesn't find one, it will > always assume it to be dirty. > > "Liz Helmecke" <L-punkt-helmecke@subnet7-punkt-de> wrote in message > news:%234lwBjJcEHA.2944@TK2MSFTNGP11.phx.gbl... > > Hello NG, > > > > VS 2003 / VB.NET / SQL-Server-Windows-App: > > > > On a Windows-Form are some Textboxes and Combos and so on, and 2 > > Richttextboxes. > > All these are bound to the Dataset: > > Databinding.Add(new Binding("Text", ...)) or, if it is a Richtextbox: > > ...(new Binding("Rtf", ...) > > > > Now, after the User has edited anything and leaves the Record, I want to > ask > > him "Do you want to save your changes?" > > So, I check if myDataSet.HasChanges. > > If it has no Changes, the record can be left immediately. If it has, the > "Do > > you want to..."-Message is popping up. > > > > If the Richtextboxes-Binding is with the "Text"-Property, everything > works > > fine. > > But if I use the "Rtf"-Property for the Binding, the Dataset tells me > > always, HasChanges is True, even if it's not! > > > > Since I need the formatting-possibilities and need to save it in the > > database, how could I solve this issue? > > > > Any ideas? I would be glad. > > Thank you! > > Liz > > > > > >
Don't see what you're looking for? Try a search.
|