Deleting DataGridViewRow with Underlying DataRelation

Hi,

I have a DataGridView which is populated from a DataTable that has a foreign key constraint linking it to another DataTable.

When I delete a row in the DataGridView that the second DataTable depends on, the DataError event is fired because the deletion will cause orphan rows in the second DataTable.

Is there any way to delete/remove a row from the DataGridView (rendering it not visible to the user) without deleting it in the underlying DataTable?

This would be useful becuase I never want to physically delete records, but rather to set a boolean flag indicating it as deleted.

Thanks.
AMLabelsAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
Me.DataGridView1.Rows(0).Height = 0

Bob
0
 
Bob LearnedCommented:
Me.DataGridView1.Rows(0).Visible = False

Bob
0
 
AMLabelsAuthor Commented:
I tried setting the row visible to false, but the application throws an error stating that the operation was not allowed in the current context.
0
 
Bob LearnedCommented:
Not a good enough answer?  Did you manage to do something else?  What was your final solution?

Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.