Re: binder.Current.row.rowstate not reflecting actual state of child row

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



ahhhhhhhhhhhh - I tried that before in a slighly different syntax and just
missed it.

Thanks !!

"Bart Mermuys" <bmermuys.nospam@xxxxxxxxxxx> wrote in message
news:%23RGbr2ylFHA.320@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
> [inline]
>
> "astro" <astro@xxxxxxxx> wrote in message
> news:OjzHe.1974$Zh.295@xxxxxxxxxxxxxxxxxxxxxxxx
>> 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]" <notmyfirstname@xxxxxxxxx> wrote in message
>> news:eM0pgPllFHA.3568@xxxxxxxxxxxxxxxxxxxxxxx
>>> 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
>>>
>>
>>
>
>
>


.



Relevant Pages

  • Re: binder.Current.row.rowstate not reflecting actual state of child row
    ... > Thanks Cor --) ... > I am trying to trap state changes for a child table on a form when from ... There is a chance you're getting the wrong CurrencyManager and so the wrong ... if your detail table can contain multiple detail rows for each master ...
    (microsoft.public.dotnet.languages.vb)
  • Getting Possition of SubTable
    ... Now if I navigate throug the DataGrid, I'm getting the Position of Master ... Child and how I can get the Position with CurrencyManager of the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Multi-body or Assembly?
    ... components are so intimately intertwined that in-context is a terribly ... I want to keep the rebuild time of the master model as short as ... model don't transfer to the child parts - dims in the child parts ... It was odd to hear you say that the SWx establishment is opposed to ...
    (comp.cad.solidworks)
  • Re: Probleme mit dem ForeingKeyConstraint vielleicht die Ursache meine Problems
    ... > New Row's: Master ... > Updated Row's: Master ... > Updated Row's: Child ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • Timer on master page causes the child page to go through its page
    ... I have numerous child pages that inherit from the master page. ... I get the desired effect of the timer checking for some event and updating ... Doesn't render the html because it is a call back and only updates the ...
    (microsoft.public.dotnet.framework.aspnet)