I'm working through the binder stuff trying to get a handle on it...
I have setup a master-detail dataset and have a couple of textboxes from the
master along with a datadgrid for the child data.
I have a navigation pallete with the usual arrows. All arrow btn's are
handled by the same handler.
Before moving off the current record I do the following:
BindingContext(Me.DataSet11, "table2").EndCurrentEdit()
BindingContext(Me.DataSet11, "table1").EndCurrentEdit()
'deal with current row state 1st
checkRowState(sender, e)
CheckRowSTate looks at the rowstate and calls the SaveRecord routnine if
needed.
Select Case mbinder.Current.row.rowstate
Case DataRowState.Added
Call saveRecord()
Case DataRowState.Modified
Call saveRecord()
End Select
Select Case mbinder2.Current.row.rowstate
Case DataRowState.Added
Call saveRecord()
Case DataRowState.Modified
Call saveRecord()
End Select
The problem i'm having is this: after changing a value in the child
(datagrid) description field the rowstate remains unchanged on the 2nd or
greater master record. If I make a change to the child rec on the 1st
master the rowstate is 'modified' as expected.....
at this point i'm just bewildered............. 6 1768
Astro,
I am afraid that I don't understand your problem, however, a rowstate
reflects only the state of the changed datarow, where it is not important if
this is a child or a master.
To get more answers, I give you the advice to past in next time your code
first in a notebook copy it back and past it in a message. Now it is hard to
see in most newsreaders what your code looks like.
I hope this helps anyhow
Cor
Thanks Cor -- )
I am trying to trap state changes for a child table on a form when from
'unchanged' to 'modified' or 'added.' The code I am using does not do this.
I will repost it here:
form load:
========
cmT2 = CType(Me.BindingContext(Me.DataSet11.Tables!table2 ), CurrencyManager)
custom SaveRecord event:
===================
cmT2.EndCurrentEdit()
Select Case cmT2.Current.row.rowstate
Case DataRowState.Added
Stop
Case DataRowState.Modified
Stop
End Select
Before the postion changes on the form's master record, the 'saverecord'
code is called. When I make changes to the datagrid - which is populated by
the 'child' table and linked via the 'datamember' property using the
'table1table2' relation - and then move to another 'parent' record the
saveRecord event is called does not report an 'Added' or 'Modified' state in
the child table.
any ideas?
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl... Astro,
I am afraid that I don't understand your problem, however, a rowstate reflects only the state of the changed datarow, where it is not important if this is a child or a master.
To get more answers, I give you the advice to past in next time your code first in a notebook copy it back and past it in a message. Now it is hard to see in most newsreaders what your code looks like.
I hope this helps anyhow
Cor
Hi,
[inline]
"astro" <as***@mnrr.com> wrote in message
news:Oj***************@tornado.rdc-kc.rr.com... Thanks Cor -- )
I am trying to trap state changes for a child table on a form when from 'unchanged' to 'modified' or 'added.' The code I am using does not do this. I will repost it here:
form load: ======== cmT2 = CType(Me.BindingContext(Me.DataSet11.Tables!table2 ), CurrencyManager)
There is a chance you're getting the wrong CurrencyManager and so the wrong
Current DataRowView. You have to use the same DataSource/DataMember that
you used for binding to get the CurrencyManager.
Eg.:
detailGrid.DataSource = DataSet11
detailGrid.DataMember = "master_table.master_to_detail_relation"
cmT2 = DirectCast(BindingContext(DataSet11,
"master_table.master_to_detail_relation"), CurrencyManager)
A more generic way:
cmT2 = DirectCast(BindingContext(detailGrid.DataSource,
detailGrid.DataMember), CurrencyManager)
Also, if your detail table can contain multiple detail rows for each master
row, then you might want to use detailTable.GetChanges() or
detailTable.Select(), because the user could have changed multiple detail
rows before navigating master rows.
HTH,
Greetings
custom SaveRecord event: ===================
cmT2.EndCurrentEdit()
Select Case cmT2.Current.row.rowstate Case DataRowState.Added Stop Case DataRowState.Modified Stop End Select
Before the postion changes on the form's master record, the 'saverecord' code is called. When I make changes to the datagrid - which is populated by the 'child' table and linked via the 'datamember' property using the 'table1table2' relation - and then move to another 'parent' record the saveRecord event is called does not report an 'Added' or 'Modified' state in the child table.
any ideas?
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:eM**************@TK2MSFTNGP10.phx.gbl... Astro,
I am afraid that I don't understand your problem, however, a rowstate reflects only the state of the changed datarow, where it is not important if this is a child or a master.
To get more answers, I give you the advice to past in next time your code first in a notebook copy it back and past it in a message. Now it is hard to see in most newsreaders what your code looks like.
I hope this helps anyhow
Cor
Astro, Before the postion changes on the form's master record, the 'saverecord' code is called.
How are you able to do that? (before)
Cor
ahhhhhhhhhhhh - I tried that before in a slighly different syntax and just
missed it.
Thanks !!
"Bart Mermuys" <bm*************@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl... Hi, [inline]
"astro" <as***@mnrr.com> wrote in message news:Oj***************@tornado.rdc-kc.rr.com... Thanks Cor -- )
I am trying to trap state changes for a child table on a form when from 'unchanged' to 'modified' or 'added.' The code I am using does not do this. I will repost it here:
form load: ======== cmT2 = CType(Me.BindingContext(Me.DataSet11.Tables!table2 ), CurrencyManager)
There is a chance you're getting the wrong CurrencyManager and so the wrong Current DataRowView. You have to use the same DataSource/DataMember that you used for binding to get the CurrencyManager.
Eg.: detailGrid.DataSource = DataSet11 detailGrid.DataMember = "master_table.master_to_detail_relation"
cmT2 = DirectCast(BindingContext(DataSet11, "master_table.master_to_detail_relation"), CurrencyManager)
A more generic way: cmT2 = DirectCast(BindingContext(detailGrid.DataSource, detailGrid.DataMember), CurrencyManager)
Also, if your detail table can contain multiple detail rows for each master row, then you might want to use detailTable.GetChanges() or detailTable.Select(), because the user could have changed multiple detail rows before navigating master rows.
HTH, Greetings
custom SaveRecord event: ===================
cmT2.EndCurrentEdit()
Select Case cmT2.Current.row.rowstate Case DataRowState.Added Stop Case DataRowState.Modified Stop End Select
Before the postion changes on the form's master record, the 'saverecord' code is called. When I make changes to the datagrid - which is populated by the 'child' table and linked via the 'datamember' property using the 'table1table2' relation - and then move to another 'parent' record the saveRecord event is called does not report an 'Added' or 'Modified' state in the child table.
any ideas?
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:eM**************@TK2MSFTNGP10.phx.gbl... Astro,
I am afraid that I don't understand your problem, however, a rowstate reflects only the state of the changed datarow, where it is not important if this is a child or a master.
To get more answers, I give you the advice to past in next time your code first in a notebook copy it back and past it in a message. Now it is hard to see in most newsreaders what your code looks like.
I hope this helps anyhow
Cor
See Bart's response Cor.
0)
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl... Astro,
Before the postion changes on the form's master record, the 'saverecord' code is called.
How are you able to do that? (before)
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: TEbert |
last post by:
I have an Expression based DataColumn that is defined to calculate the Qty
sum of all child rows, based on a self-referencing relationship (i.e.
Parent.aggregateQty =...
|
by: BStorm |
last post by:
Is it possible to change individual RowState properties from updated to not
updated?
|
by: John Dalberg |
last post by:
I am setting the HttpContext.Current.User in the
Application_AuthenticateRequest event in global.asax.cs. When I use the
IsInRole function in a web page, it works fine. So far so good. (Note that...
|
by: |
last post by:
Hi all, I have a question on reflection
Lets say I have a custom object called Address. Now, lets say I have a
string variable that holds the name of a variable in the object such as...
|
by: osmarjunior |
last post by:
Is there a way to change manually the RowState property of a DataRow,
in a DataTable??
I wanna create a DataTable in memory, so I do the following:
DataRow row = tbl.DataTable.NewRow();
row =...
|
by: namewitheldbyrequest |
last post by:
"The XML element 'EnableTheming' from namespace 'http://tempuri.org/'
is
already present in the current scope"
I created a Web Service: I imported System.Data.SqlClient so I could
access SQL...
|
by: Arpan |
last post by:
What's the difference between RowState & DataViewRowState?
If I am not mistaken, RowState pertains to DataTable whereas
DataViewRowState pertains to DataView but the "Select" method of the...
|
by: Dale Harris |
last post by:
I'm getting really strange behaviour where the data source RowState is not being updated to modified in some circumstances.
I place my controls on a form, bind them through a BindingSource control...
|
by: perspolis |
last post by:
Hi all
I have a master detail table which I use them in Transaction to Update them.
in some cases the detail table generates error and I Rollback transaction
but RowState of master table dosen't...
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |