473,830 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataSet.HasChan ges and Textbox.TextCha nged Event

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.HasChan ges to true. Only the subsequent character change
sets the DataSet.HasChan ges 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.HasChan ges 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
Jul 21 '05 #1
2 3808
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
Jul 21 '05 #2
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

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4291
by: David Smith | last post by:
What I want to be able to do: A textbox is available that the user can enter information into. Specifically (for the purposes of this post), the user is asked to enter a number, and that number has an upper limit. I want to do validation on what the user enters as they type it in. I set up an event handler for KeyPress that restricts them from being able to enter non-numeric characters (only allowing numbers, decimal point, control...
2
4830
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different row selected in the datagrid. I want to save the changes that user make in the textboxes when they select a different row in the datagrid. I tried capturing the textbox.text at datagrid's CurrentCellChanged event but by then the textbox.text...
3
3715
by: Alpha | last post by:
Hi, I have a window C# application. I update the dataset when user finished entering in a text box. But when I want to update the database when OK is pressed, the if(dsVehicle.HasChanges(DataRowState.Modified)) would return false and update of the dataset would take place. I do notice that if I select other item that the textbox is bind to then the modified indicator would then return true. Is there any code that I can add in the...
5
2609
by: Vi | last post by:
Hello, I want to be able to reload a DropDownList when a TextBox changes its value. So I set the AutopostBack property of the TextBox to true and in the code behind I do something like: if(IsPostBack) { if( ((TextBox)sender).ID == "myTextBox" ) myDropDownList.DataBind(); }
4
7403
by: MattB | last post by:
Hi. I'm working on an intranet application that requires a user to input information about themselves. I have a user control with a couple of textboxes that I want the user to enter their weight into. One is for Lbs and one is for kg and I'm using the OnTextChanged event to populate the other control if one is filled in (converting between kg and Lbs). It works, but when one TextBox is changed and it sets the other's value, the second...
3
2189
by: DotNetNewbie | last post by:
I am reading the book Teach Yourself Microsoft Visual Basic .Net 2003 in 21 Days. I am having trouble getting one of the exercises to work at the end of day 4. Exercises: 1. Create a new multiple-form application that displays two forms when it starts, each with a text box. Add code to each text box’s TextChanged event (this is the
2
384
by: jbsound | last post by:
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...
4
29806
by: Jason Huang | last post by:
Hi, In my C# Windows form MyForm I have some TextBoxes. In these TextBoxes, we have to detect if the TextChanged event occurs, if there're changes in these TextBoxes, it will ask if we want to save the changes when we close the form. However, when I run the MyForm, it will fetch data from the system and put into TextBoxes, and this incurs the textchanged event. But I am thinking how do I make the TextBox's TextChanged know the
1
1084
by: Peter Newman | last post by:
I have a problem i donr seem to be able to find a soloution to i have created a dataset, binded the controls to it, set primary keys managed to set up navigation through the table and even search for a value and move to that record. I have now come to an abrupt halt with something i thought would be simple .. updating records. I have tried using the Client_RS.HasChanges(DataRowState.Modified) function ( Client_Rs being my Dataset )
0
9780
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10476
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10196
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5775
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4408
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3956
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3070
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.