PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Detect when user modifies a value in a bound textbox
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Detect when user modifies a value in a bound textbox
![]() |
Detect when user modifies a value in a bound textbox |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I have a form which views exactly one record from a dataset. It uses a BindingSource and has bindings linking several textboxes to the data. I would like to enable / disable the "Close" "OK" and "Cancel" buttons on the form according to the row status; What is the best way to do this? I can't find an event which fires when the user modifies a value in a bound text box - I don't want to add a handler for every "TextChanged" event! Thanks for any ideas, James |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi James,
Did you try using BindingSource.CurrentItemChanged event? -- Miha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "James Minns" <minns@DELETEME.inwind.it> wrote in message news:ea2gQTElGHA.4508@TK2MSFTNGP05.phx.gbl... > Hi, > I have a form which views exactly one record from a dataset. It uses a > BindingSource and has bindings linking several textboxes to the data. > > I would like to enable / disable the "Close" "OK" and "Cancel" buttons on > the form according to the row status; What is the best way to do this? I > can't find an event which fires when the user modifies a value in a bound > text box - I don't want to add a handler for every "TextChanged" event! > > Thanks for any ideas, > James > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
I did try that; the event fires four times during the initialization of the
form when I press the OK button, but never when a bound text box is modified. This works if I call it every second, but I need an event: Dim drView As DataRowView = MyBindingSource.Current If drView.Row.HasVersion(DataRowVersion.Proposed) Then UserHasModifiedSomething = True James "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:%23qu2xcElGHA.2304@TK2MSFTNGP02.phx.gbl... > Hi James, > > Did you try using BindingSource.CurrentItemChanged event? > > -- > Miha Markic [MVP C#] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "James Minns" <minns@DELETEME.inwind.it> wrote in message > news:ea2gQTElGHA.4508@TK2MSFTNGP05.phx.gbl... >> Hi, >> I have a form which views exactly one record from a dataset. It uses a >> BindingSource and has bindings linking several textboxes to the data. >> >> I would like to enable / disable the "Close" "OK" and "Cancel" buttons on >> the form according to the row status; What is the best way to do this? I >> can't find an event which fires when the user modifies a value in a bound >> text box - I don't want to add a handler for every "TextChanged" event! >> >> Thanks for any ideas, >> James >> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
You might implement DataTable.ColumnChanged event then.
-- Miha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "James Minns" <minns@DELETEME.inwind.it> wrote in message news:eqllp4ElGHA.3816@TK2MSFTNGP02.phx.gbl... >I did try that; the event fires four times during the initialization of the >form when I press the OK button, but never when a bound text box is >modified. > > This works if I call it every second, but I need an event: > > Dim drView As DataRowView = MyBindingSource.Current > If drView.Row.HasVersion(DataRowVersion.Proposed) Then > UserHasModifiedSomething = True > James > > > > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message > news:%23qu2xcElGHA.2304@TK2MSFTNGP02.phx.gbl... >> Hi James, >> >> Did you try using BindingSource.CurrentItemChanged event? >> >> -- >> Miha Markic [MVP C#] >> RightHand .NET consulting & development www.rthand.com >> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >> >> "James Minns" <minns@DELETEME.inwind.it> wrote in message >> news:ea2gQTElGHA.4508@TK2MSFTNGP05.phx.gbl... >>> Hi, >>> I have a form which views exactly one record from a dataset. It uses a >>> BindingSource and has bindings linking several textboxes to the data. >>> >>> I would like to enable / disable the "Close" "OK" and "Cancel" buttons >>> on the form according to the row status; What is the best way to do >>> this? I can't find an event which fires when the user modifies a value >>> in a bound text box - I don't want to add a handler for every >>> "TextChanged" event! >>> >>> Thanks for any ideas, >>> James >>> >> >> > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Perfect - problem solved!
Thank you very much. James "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:eolUnJFlGHA.1264@TK2MSFTNGP05.phx.gbl... > You might implement DataTable.ColumnChanged event then. > > -- > Miha Markic [MVP C#] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "James Minns" <minns@DELETEME.inwind.it> wrote in message > news:eqllp4ElGHA.3816@TK2MSFTNGP02.phx.gbl... >>I did try that; the event fires four times during the initialization of >>the form when I press the OK button, but never when a bound text box is >>modified. >> >> This works if I call it every second, but I need an event: >> >> Dim drView As DataRowView = MyBindingSource.Current >> If drView.Row.HasVersion(DataRowVersion.Proposed) Then >> UserHasModifiedSomething = True >> James >> >> >> >> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message >> news:%23qu2xcElGHA.2304@TK2MSFTNGP02.phx.gbl... >>> Hi James, >>> >>> Did you try using BindingSource.CurrentItemChanged event? >>> >>> -- >>> Miha Markic [MVP C#] >>> RightHand .NET consulting & development www.rthand.com >>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >>> >>> "James Minns" <minns@DELETEME.inwind.it> wrote in message >>> news:ea2gQTElGHA.4508@TK2MSFTNGP05.phx.gbl... >>>> Hi, >>>> I have a form which views exactly one record from a dataset. It uses a >>>> BindingSource and has bindings linking several textboxes to the data. >>>> >>>> I would like to enable / disable the "Close" "OK" and "Cancel" buttons >>>> on the form according to the row status; What is the best way to do >>>> this? I can't find an event which fires when the user modifies a value >>>> in a bound text box - I don't want to add a handler for every >>>> "TextChanged" event! >>>> >>>> Thanks for any ideas, >>>> James |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

