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 ") 3 2756
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 ")
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 ")
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 ") > > > > 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 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...
|
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...
|
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.
|
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?
|
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...
| |
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...
|
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)
|
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...
|
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
|
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...
|
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...
| |
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...
|
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,...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |