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 rowversion.original
and rowversion.current 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.componentModel
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.sqldataadapter1.fill(me.dataset11)
me.textbox1.databindings.add(new system.windows.forms.binding("text",
dataset11, "table1.Field1")
me.NewControl1.databinding.add(new
system.windows.form.binding("NewValue",dataset11," table1.field2")
me.BindingContext(dataset11, "table1").EndCurrentEdit()
dim n as integer
if dataset11.getchanges is nothing then msgbox("noting") else
msgbox("changed") 3 2720
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*****@hotmail.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.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 rowversion.original and rowversion.current 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.componentModel 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.sqldataadapter1.fill(me.dataset11) me.textbox1.databindings.add(new system.windows.forms.binding("text", dataset11, "table1.Field1") me.NewControl1.databinding.add(new system.windows.form.binding("NewValue",dataset11," table1.field2") me.BindingContext(dataset11, "table1").EndCurrentEdit() dim n as integer if dataset11.getchanges is nothing then msgbox("noting") else msgbox("changed")
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*****@hotmail.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.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 rowversion.original and rowversion.current 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.componentModel 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.sqldataadapter1.fill(me.dataset11) me.textbox1.databindings.add(new system.windows.forms.binding("text", dataset11, "table1.Field1") me.NewControl1.databinding.add(new system.windows.form.binding("NewValue",dataset11," table1.field2") me.BindingContext(dataset11, "table1").EndCurrentEdit() dim n as integer if dataset11.getchanges is nothing then msgbox("noting") else msgbox("changed")
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)).EndCurrentEdit()
Probably you need this in your control somewhere.
Cor
"Albert" <Al****@discussions.microsoft.com> schreef in bericht
news:F0**********************************@microsof t.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*****@hotmail.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.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 > rowversion.original and rowversion.current 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.componentModel > 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.sqldataadapter1.fill(me.dataset11) > me.textbox1.databindings.add(new system.windows.forms.binding("text", > dataset11, "table1.Field1") > me.NewControl1.databinding.add(new > system.windows.form.binding("NewValue",dataset11," table1.field2") > me.BindingContext(dataset11, "table1").EndCurrentEdit() > dim n as integer > if dataset11.getchanges is nothing then msgbox("noting") else > msgbox("changed") > > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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. ...
|
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...
|
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...
|
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...
...
|
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...
|
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
| |