Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
Posted (edited)

I figured it out...Here is the code I ended up with for anyone who

has the same problem:

 

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]

Edited by Robby

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...