DataGrid Parent/Child

RobEmDee

Centurion
Joined
Mar 25, 2003
Messages
130
Location
Richmond, VA
I am trying to take advantage of the Parent/Child display in the Windows DataGrid similar to the SubDataSheet in Access. My problem is I am able to set the DefaultView.AllowNew = False for the Parent table but when I set the same thing for the Child table I still get the AddNew ('*') row at the bottom of the DataGrid when the Child Data is viewed. Any suggestions?
 
I figured it out...Here is the code I ended up with for anyone who
has the same problem:

Visual Basic:
Dim cm as CurrencyManager

Me.DstParentChild1.Tables(0).DefaultView.AllowNew = False

cm = CType(Me.BindingContext(Me.DstParentChild1.Table(0), _ 
         Me.DstParentChild1.Relations(0).RelationName), _ 
         CurrencyManager)

CType(cm.List, DataView).AllowNew = False
        
Me.DataGrid1.DataSource = Me.DstParentChild1.Tables(0)
Not very straightforward at first blush...but makes sense after
reading up on the CurrencyManager documentation.

[edit]is that better?[/edit]
 
Last edited by a moderator:
Back
Top