PC Review


Reply
Thread Tools Rate Thread

DataSet.HasChanges and Textbox.TextChanged Event

 
 
=?Utf-8?B?amJzb3VuZA==?=
Guest
Posts: n/a
 
      17th Feb 2005
I have been banging my head against this one and I'm sure I'm missing
something:

Got a WinForms app in VB.NET with controls bound to a dataset. For the sake
of this discussion, let's use just one text box control. When the user makes
changes, the first character change in the text box will not set the
underlying DataSet.HasChanges to true. Only the subsequent character change
sets the DataSet.HasChanges to true. Why is that?

More importantly, here is what I need to do:

I need to give the user visual feedback that the record in the dataset is
'dirty' as soon as the user makes the first change. More importantly, if the
user changes only ONE single character, the DataSet.HasChanges needs to be
true so that the rest of my verification and validation code works and I can
prompt the user to save if there are changes that have to be yet written back
to the database table.

How can I do that?

Thanks,

JB
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      18th Feb 2005
JBSound,

First what you tell seems to me impossible.

Data is pushed in the dataset by a change of the current row.

That is why when by instance a button acts as the start for an update, the
first thing that must be done is an endcurrentedit.

So when you want to do what you want, you need something as do everytime
when there is a value change in your textbox an encurrentedit.

I am afraid that your user will not be happy because of the strange effect
it probably has.( I did not thest it).

I hope this helps something.

Cor


 
Reply With Quote
 
=?Utf-8?B?amJzb3VuZA==?=
Guest
Posts: n/a
 
      18th Feb 2005
Thanks for your time responding. However, I disagree with you on your
assessment that this is not possible. I have this working with some issues
that still need to be addressed.

To further clarify:

I use the TextChanged event of the text box to see if the dataset has
changes. However, as I have found out in the mean time, that's not
necessarily the place to check, or at least not with the EndCurrentEdit
method of the BindingContext for the dataset. Problem there is that
TextChanged happens before the dataset gets updated. So I have to find
another way of pulling this off.

The other aspect of that is that if a TextChange event occurred, the dataset
would already be different, unless that change is cancelled.

Thanks for your attempt to help!

JB

"Cor Ligthert" wrote:

> JBSound,
>
> First what you tell seems to me impossible.
>
> Data is pushed in the dataset by a change of the current row.
>
> That is why when by instance a button acts as the start for an update, the
> first thing that must be done is an endcurrentedit.
>
> So when you want to do what you want, you need something as do everytime
> when there is a value change in your textbox an encurrentedit.
>
> I am afraid that your user will not be happy because of the strange effect
> it probably has.( I did not thest it).
>
> I hope this helps something.
>
> Cor
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web TextBox TextChanged Event pvdg42 Microsoft ASP .NET 2 14th Nov 2006 05:15 AM
TextBox: TextChanged event question Fabio Cannizzo Microsoft C# .NET 2 9th Jan 2006 12:34 PM
Textbox.TextChanged event Jerry Spence1 Microsoft VB .NET 3 25th Oct 2005 12:25 AM
TextBox.TextChanged event not firing! =?Utf-8?B?ZGhucml2ZXJzaWRl?= Microsoft ASP .NET 4 19th Aug 2005 11:03 AM
delaying TextBox.TextChanged event VMI Microsoft C# .NET 2 8th Dec 2004 09:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:59 AM.