In Chap 13 David shows you how to bind a second form to the same data source
by passing the CurrencyManager as an arg to the EditDetail Method of the
second form:

Public Sub EditDetail(byval CM as CurrencyManager)

drvDetail = Ctype(CM.Current, DataRowView)
vueDetail = drvDetail.DataView

Me.BindingContext(vueDetail).Position = CM.Position

I have run into a problem that I am really stumped on - if the CM passed in
has no Current position, which would be the case if you were possibly adding
the first row to a child table, then you can not get at the DataView.

Is there some other way to get to the DataView?

This is also a problem I am faced with when I have a DataView of a parent
table and use the following code to bind children where the DataMember is a
relationship:

With grdGuestContacts
.DataSource = oParentsView
.DataMember = "tblGueststblGuestContacts"
CM = CType(Me.BindingContext(.DataSource, .DataMember), CurrencyManager)
end with

If the child table has no records there is no way (that I know of) to get at
the DataView in order to disable AllowNew because CM.Current is NOT on a
current record.

Any ideas?

--
--------------------------
Thanks - Jay Pondy
--------------------------
We see the world, not as it is, but as we are.

RE: Sceppa's ADO.Net Bible Question by jpondy

jpondy
Fri Mar 11 18:21:01 CST 2005

Why is it that no matter how much time you spend trying to figure a problem
out that within minutes of posting it you find the answer?

If the CurrencyManager has no Current record than the DataView can be
obtained by casting its List object as:

dim oView as dataview = ctype(CM.List, DataView)

"Jay Pondy" wrote:

> In Chap 13 David shows you how to bind a second form to the same data source
> by passing the CurrencyManager as an arg to the EditDetail Method of the
> second form:
>
> Public Sub EditDetail(byval CM as CurrencyManager)
>
> drvDetail = Ctype(CM.Current, DataRowView)
> vueDetail = drvDetail.DataView
>
> Me.BindingContext(vueDetail).Position = CM.Position
>
> I have run into a problem that I am really stumped on - if the CM passed in
> has no Current position, which would be the case if you were possibly adding
> the first row to a child table, then you can not get at the DataView.
>
> Is there some other way to get to the DataView?
>
> This is also a problem I am faced with when I have a DataView of a parent
> table and use the following code to bind children where the DataMember is a
> relationship:
>
> With grdGuestContacts
> .DataSource = oParentsView
> .DataMember = "tblGueststblGuestContacts"
> CM = CType(Me.BindingContext(.DataSource, .DataMember), CurrencyManager)
> end with
>
> If the child table has no records there is no way (that I know of) to get at
> the DataView in order to disable AllowNew because CM.Current is NOT on a
> current record.
>
> Any ideas?
>
> --
> --------------------------
> Thanks - Jay Pondy
> --------------------------
> We see the world, not as it is, but as we are.
>

RE: Sceppa's ADO.Net Bible Question by davidsc

davidsc
Fri Mar 11 19:36:18 CST 2005


I think it's a corollary to Murphy's Law. ;-)

No worries. It happens all the time.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2005 Microsoft Corporation. All rights reserved.


Re: Sceppa's ADO.Net Bible Question by Jay

Jay
Tue Mar 15 06:43:11 CST 2005

David

Just wanted to congratulate and compliment you on a truly awesome book
- by far the most used in my extensive library - excellent writing,
layout and solutions for real problems. Keep up the great work as I
am really looking forward to wearing out version 2.0 as well.

On Sat, 12 Mar 2005 01:36:18 GMT, davidsc@online.microsoft.com (David
Sceppa) wrote:

>
> I think it's a corollary to Murphy's Law. ;-)
>
> No worries. It happens all the time.
>
>David Sceppa
>Microsoft
>This posting is provided "AS IS" with no warranties,
>and confers no rights. You assume all risk for your use.
>© 2005 Microsoft Corporation. All rights reserved.