473,802 Members | 1,978 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 3806
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
4289
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
4828
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
3713
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
2608
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
7402
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
2187
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
29803
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
1083
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
9699
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
10305
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...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
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
9115
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...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4270
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
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.