473,770 Members | 6,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dataset.getchan ge always flag true when bind to a custom controls

AH
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.getchan ges ... 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 rowversion.orig inal
and rowversion.curr ent to compare all fields but find evertything to be
exactly the same ...I wonder whatelse that getchanges has discovered that I
am not aware of ..??
however, if I bind it to a standard control like textbox, it is ok .... so
what is wrong here .. have I miss anything when creating the new control
?...or have getchanges discovered some strange items that I am not aware of
?? please help
Thank you ..

Albert

sample code:
--- for new controls ---
imports system.componen tModel
public class NewControl
inherits system.windows. forms.textbox
private strVar as string
........
---
public property NewValue as string
Get
return strVar
Set (byval value as string)
strVar = value
End Set
End Property

End class

------------
for the binding

' set up the dataadapter .. dataset ... etc.
me.sqldataadapt er1.fill(me.dat aset11)
me.textbox1.dat abindings.add(n ew system.windows. forms.binding(" text",
dataset11, "table1.Field1" )
me.NewControl1. databinding.add (new
system.windows. form.binding("N ewValue",datase t11,"table1.fie ld2")
me.BindingConte xt(dataset11, "table1").EndCu rrentEdit()
dim n as integer
if dataset11.getch anges is nothing then msgbox("noting" ) else
msgbox("changed ")


Nov 21 '05 #1
3 2754
AH,

Why do you not just debug it, is maybe your usercontrol doing an automatic
update of a textbox or whatever on your usercontrol and with that pushing
down the blank information in your datarow.

Cor

"AH" <ha*****@hotmai l.com>
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.getchan ges ... 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
rowversion.orig inal and rowversion.curr ent to compare all fields but find
evertything to be exactly the same ...I wonder whatelse that getchanges
has discovered that I am not aware of ..??
however, if I bind it to a standard control like textbox, it is ok .... so
what is wrong here .. have I miss anything when creating the new control
?...or have getchanges discovered some strange items that I am not aware
of ?? please help
Thank you ..

Albert

sample code:
--- for new controls ---
imports system.componen tModel
public class NewControl
inherits system.windows. forms.textbox
private strVar as string
.......
---
public property NewValue as string
Get
return strVar
Set (byval value as string)
strVar = value
End Set
End Property

End class

------------
for the binding

' set up the dataadapter .. dataset ... etc.
me.sqldataadapt er1.fill(me.dat aset11)
me.textbox1.dat abindings.add(n ew system.windows. forms.binding(" text",
dataset11, "table1.Field1" )
me.NewControl1. databinding.add (new
system.windows. form.binding("N ewValue",datase t11,"table1.fie ld2")
me.BindingConte xt(dataset11, "table1").EndCu rrentEdit()
dim n as integer
if dataset11.getch anges is nothing then msgbox("noting" ) else
msgbox("changed ")

Nov 21 '05 #2
hi,

I have done the debug ... but can't see anything that gone wrong ... the new
property tested is just plain set value and get value to a private variable
... logically, it should be the same right? set a value to a variable and get
the value back .. ?? but the databinding also flag it as changed ... I tried
with "text" property and it don't flag change ??? next puzzle is I tried to
use the rowversion to read the original and current value of the so call
changed row but it showed all to be the same (contents and types). ... so
next question is .. is there anything else that the getchanges method
detected that the original and current row state don't tell ??

Thank,

Albert
"Cor Ligthert" wrote:
AH,

Why do you not just debug it, is maybe your usercontrol doing an automatic
update of a textbox or whatever on your usercontrol and with that pushing
down the blank information in your datarow.

Cor

"AH" <ha*****@hotmai l.com>
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.getchan ges ... 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
rowversion.orig inal and rowversion.curr ent to compare all fields but find
evertything to be exactly the same ...I wonder whatelse that getchanges
has discovered that I am not aware of ..??
however, if I bind it to a standard control like textbox, it is ok .... so
what is wrong here .. have I miss anything when creating the new control
?...or have getchanges discovered some strange items that I am not aware
of ?? please help
Thank you ..

Albert

sample code:
--- for new controls ---
imports system.componen tModel
public class NewControl
inherits system.windows. forms.textbox
private strVar as string
.......
---
public property NewValue as string
Get
return strVar
Set (byval value as string)
strVar = value
End Set
End Property

End class

------------
for the binding

' set up the dataadapter .. dataset ... etc.
me.sqldataadapt er1.fill(me.dat aset11)
me.textbox1.dat abindings.add(n ew system.windows. forms.binding(" text",
dataset11, "table1.Field1" )
me.NewControl1. databinding.add (new
system.windows. form.binding("N ewValue",datase t11,"table1.fie ld2")
me.BindingConte xt(dataset11, "table1").EndCu rrentEdit()
dim n as integer
if dataset11.getch anges is nothing then msgbox("noting" ) else
msgbox("changed ")


Nov 21 '05 #3
Albert,

Your first problem was that it was always flagged. When not, maybe it is an
easy answer.
How do you do the flag setting in your control, when you want to force that
when there is a change you can use the endcurrentedit?

As sample
BindingContext( ds.Tables(0)).E ndCurrentEdit()

Probably you need this in your control somewhere.

Cor

"Albert" <Al****@discuss ions.microsoft. com> schreef in bericht
news:F0******** *************** ***********@mic rosoft.com...
hi,

I have done the debug ... but can't see anything that gone wrong ... the
new
property tested is just plain set value and get value to a private
variable
.. logically, it should be the same right? set a value to a variable and
get
the value back .. ?? but the databinding also flag it as changed ... I
tried
with "text" property and it don't flag change ??? next puzzle is I tried
to
use the rowversion to read the original and current value of the so call
changed row but it showed all to be the same (contents and types). ... so
next question is .. is there anything else that the getchanges method
detected that the original and current row state don't tell ??

Thank,

Albert
"Cor Ligthert" wrote:
AH,

Why do you not just debug it, is maybe your usercontrol doing an
automatic
update of a textbox or whatever on your usercontrol and with that pushing
down the blank information in your datarow.

Cor

"AH" <ha*****@hotmai l.com>
> 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.getchan ges ... 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
> rowversion.orig inal and rowversion.curr ent to compare all fields but
> find
> evertything to be exactly the same ...I wonder whatelse that getchanges
> has discovered that I am not aware of ..??
> however, if I bind it to a standard control like textbox, it is ok ....
> so
> what is wrong here .. have I miss anything when creating the new
> control
> ?...or have getchanges discovered some strange items that I am not
> aware
> of ?? please help
> Thank you ..
>
> Albert
>
> sample code:
> --- for new controls ---
> imports system.componen tModel
> public class NewControl
> inherits system.windows. forms.textbox
> private strVar as string
> .......
> ---
> public property NewValue as string
> Get
> return strVar
> Set (byval value as string)
> strVar = value
> End Set
> End Property
>
> End class
>
> ------------
> for the binding
>
> ' set up the dataadapter .. dataset ... etc.
> me.sqldataadapt er1.fill(me.dat aset11)
> me.textbox1.dat abindings.add(n ew system.windows. forms.binding(" text",
> dataset11, "table1.Field1" )
> me.NewControl1. databinding.add (new
> system.windows. form.binding("N ewValue",datase t11,"table1.fie ld2")
> me.BindingConte xt(dataset11, "table1").EndCu rrentEdit()
> dim n as integer
> if dataset11.getch anges is nothing then msgbox("noting" ) else
> msgbox("changed ")
>
>
>
>


Nov 21 '05 #4

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

Similar topics

5
2963
by: Dave | last post by:
I tried posting this in the WinForm forum and got no hits so I am trying it here. After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is after the newly added row without getting bizarre results. I have added the full code for the test below. Create a project drop in the code and run. There is nothing crazy about the code. I used the designer to add the dataset and to...
3
3711
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...
0
1197
by: Bruno Ferreira | last post by:
Hi! Can someone help me? I have a Webform to register Users Traveller Expenses. To do this I created inside the webform a Custom DataSet, with a Custom DataTable (with some columns) with receives Custom DataRows. In my webform I let the User Fill the textboxes and when he push the add button a row is added to my DataSet and finaly a Bind him to a DataGrid.
0
983
by: dotnetguy | last post by:
Hi, I am trying to bind 20 label controls on a user control to 20 questions in a dataset. When I try the simple binding, only the Page Object shows up to be bound to - the dataset is not there. When I try a custom binding expression then I get this error -- Reference to a non-shared member requires an object reference. I am instantiating and populating the dataset in the code behind of the control. What's the best way to do this?
3
3517
by: Bill | last post by:
I have a seating chart web form that has over 50 entry field controls (tables/booths) where I use a DropDownList box to select a single company name from a single large list of organizations (200 plus conference attendees). All web form datavalues will be one of the same 200 organizations in this list. I would like to avoid creating 50 separate exact copies of the same DataSet object. Can you help? Q. Exactly how do I use the same...
3
2055
by: Ben Becker | last post by:
I am trying to build a custom crosstab type of grid where I take some items in a data grid and based on the content of the current item compared to the previous item, determine if a new row in a table should be created or not. In order to do this, I need to have full control over the conditional logic for how items get displayed within a repeater element which I'm not seeing as possible. How can I cursor through a data set, apply...
8
19544
by: Dan Keeley | last post by:
Hi, I have a dataset which is used to populate my datagrid something like this: My question is, how do I add a caluclated display column to the datagrid? It will be based on ScoreCardScore... Dim Cmd As OleDbCommand = New OleDbCommand("Select AuditDate, ScoreCardScore, DetailsScore from Audits where SupplierID = " & ComboItem.Value.ToString, conn)
3
2521
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and others. One of the custom format is as follows: dsmessages_dt.Columns.Add("Image", GetType(Image)) I had a problem of when I used a checkbox in the grid that was bound to the datatable that it would not update my dataset. So I created another...
6
5548
by: npaulus | last post by:
Hi, DataSets are usually resource heavy. Instead of having to pass them from my middle tier to my presentation layer I was wondering if anyone has developed a custom collection object that is less resource heavy and can be passed lightweight to the presentation layer. Thanks, NJ
0
9591
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
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
10225
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
10053
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
8880
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
7415
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
6676
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
5312
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...
2
3573
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.