473,770 Members | 7,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I bind a control to a dataset.haschan ges property?

Hello,

I was wondering if it was possibly to bind a control to a dataset.haschan ges
property.

The reason I want to do this is so that a little warning shows up on the
form saying that the record has not been saved.

Thank you heaps for anyones thoughts
John Sheppard
Dec 5 '07 #1
4 1309
Well, not directly. HasChanges is a method not a property so while it seems
pedantic, it is the reason it won't work. If you really needed thsi
functionality, you could create a property that simply wrapped the call to
HasChanges and bind to it instead but it would need to be subclassed. (note,
I have not specifically done this but since you can bind to other
properites, I'm 99.9% sure you'd be fine if you created a property of your
own.)
"John" <no****@nospam. comwrote in message
news:fj******** *@news5.newsguy .com...
Hello,

I was wondering if it was possibly to bind a control to a
dataset.haschan ges property.

The reason I want to do this is so that a little warning shows up on the
form saying that the record has not been saved.

Thank you heaps for anyones thoughts
John Sheppard

Dec 5 '07 #2
Ooops, I think I forgot to send this

private void Form1_Load(obje ct sender, EventArgs e)

{

AugmentedDataSe t ds = new AugmentedDataSe t();
ds.Tables.Add(n ew DataTable("What everTable"));

ds.Tables[0].Columns.Add(ne w DataColumn("MyC olumn", typeof(String)) );

chkHasChanges.D ataBindings.Add ("Checked", ds.HasChanged, null);

}

Coupled with my last post, this should do it for you

"John" <no****@nospam. comwrote in message
news:fj******** *@news5.newsguy .com...
Hello,

I was wondering if it was possibly to bind a control to a
dataset.haschan ges property.

The reason I want to do this is so that a little warning shows up on the
form saying that the record has not been saved.

Thank you heaps for anyones thoughts
John Sheppard

Dec 5 '07 #3
John:

I just went ahead and did it...
For the whole "Untyped" thing, you can just deal with this class like you
would any other dataset and if you created a typed dataset you could do the
same:

namespace WindowsApplicat ion2

{

public class AugmentedDataSe t : DataSet

{

private Boolean hasChanged;

public Boolean HasChanged

{

get { return base.HasChanges (); }

set { hasChanged = value; }

}
}

}

Now here's the binding code:

"John" <no****@nospam. comwrote in message
news:fj******** *@news5.newsguy .com...
Hello,

I was wondering if it was possibly to bind a control to a
dataset.haschan ges property.

The reason I want to do this is so that a little warning shows up on the
form saying that the record has not been saved.

Thank you heaps for anyones thoughts
John Sheppard

Dec 5 '07 #4
Thanks Ryan,

Sorry for the slow response...I shall try this out...looks good...Thank you
so much for spending the time to trial it out for me.

Kind regards
John Sheppard

"W.G. Ryan" <Wi*********@no spam.gmail.comw rote in message
news:eS******** ******@TK2MSFTN GP03.phx.gbl...
Ooops, I think I forgot to send this

private void Form1_Load(obje ct sender, EventArgs e)

{

AugmentedDataSe t ds = new AugmentedDataSe t();
ds.Tables.Add(n ew DataTable("What everTable"));

ds.Tables[0].Columns.Add(ne w DataColumn("MyC olumn", typeof(String)) );

chkHasChanges.D ataBindings.Add ("Checked", ds.HasChanged, null);

}

Coupled with my last post, this should do it for you

"John" <no****@nospam. comwrote in message
news:fj******** *@news5.newsguy .com...
>Hello,

I was wondering if it was possibly to bind a control to a
dataset.hascha nges property.

The reason I want to do this is so that a little warning shows up on the
form saying that the record has not been saved.

Thank you heaps for anyones thoughts
John Sheppard


Dec 10 '07 #5

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

Similar topics

0
1276
by: tonidapogi | last post by:
Hi! I'm having problems in updating my client database using web service. When I merge datasets (1 from the client and 1 from the web service), and try to update the client database by using the dataadapter.update method, the changes are not reflected on the client database. I temporarily created a datagrid on my form to see if the datasets are successfully being merged and it does. However, I cannot save the content of the new dataset to the...
0
1373
by: IMS.Rushikesh | last post by:
Hi All, I want to serialize an object which contain the DataTable. As DataSet is MarshalByRef object and is serializable. I am using it directly. Even my data is also serialize and save it to XML file. Now as DataSet serialize, it's creating some extra information (schema information), And i don't need that. I only want to store the data in XML format. I don't want to store extra details like namespace etc... As it's increase XML file...
4
7486
by: Brian Keating | last post by:
wonder if anyone can help me here, i've a framework 1.1 dataset which i serialize in framework 1.1 and deserialize in framework 2.0. This is fine, problem is that i want to modify some of the records in framework 2.0 and serialize the data so framework 1.1 can deserialize it and do what it required. Is this possible?
1
1896
by: TJS | last post by:
Is there a way to do this ??
7
2563
by: Jed | last post by:
I have a web service method that returns an array of custom objects marked serializeable with fully described public properties. When I bind the results to a DataGrid I can access the properties in the ItemDataBound event of the codebehind but I can't access them declaratively in the HTML code? Here is the code to call the method. net.mysite.www.WSInterface proxy; proxy = new net.mysite.www.WSInterface();
3
1378
by: Lori Markle via .NET 247 | last post by:
(Type your message here) Hi, I'm having a problem with binding a textbox to a dataset. Cananybody figure out what's going on here? I simply want to update a record. Type in a permit number andsave it to the database. I get the "cannot bind to columnpermitnumber on datasource" error, or if I add the tablename.column name into the binding, a permit number that alreadyexists pops up. Here is my code: Dim dbConn As...
3
2755
by: AH | last post by:
Hi all, I noticed this strange behavior; I created a new control (example inherits from textbox) and add a new property, then I bind this new property to a field in my dataTable in a dataSet. After the binding statement, when I check for dataset.getchanges ... it alway returns that there is changes (even the propety just set the value and get the same value to return)... I have tried to understand what has changed by using the...
5
1861
by: Franck | last post by:
how come unchanged always true even if data changed This code come from my saving button: ============================================ DataSet ds1 = new DataSet(); DataSet ds2 = new DataSet(); DataSet ds3 = new DataSet(); //Static Dataset which contain values when my form load
3
2342
by: John Sheppard | last post by:
Hello there, I have the following code; I do this as a work around for a dataset.haschanges method which doesnt appear to work correctly either For Each dt As DataTable In myDs.Tables If Not dt.GetChanges(DataRowState.Added) Is Nothing Then hasChanges=true If Not dt.GetChanges(DataRowState.Modified) Is Nothing Then hasChanges=true If Not dt.GetChanges(DataRowState.Deleted) Is Nothing Then
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9870
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
8886
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
7416
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
6678
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
5313
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
3972
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
3576
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.