Deleting DataGridViewRow with Underlying DataRelation

Posted on 2006-06-26
Medium Priority
Last Modified: 2008-02-01

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.

Question by:AMLabels
  • 3
LVL 96

Expert Comment

by:Bob Learned
ID: 16985941
Me.DataGridView1.Rows(0).Visible = False


Author Comment

ID: 16990565
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.
LVL 96

Accepted Solution

Bob Learned earned 1000 total points
ID: 16996716
Me.DataGridView1.Rows(0).Height = 0

LVL 96

Expert Comment

by:Bob Learned
ID: 17000126
Not a good enough answer?  Did you manage to do something else?  What was your final solution?


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Through the video, you can check the migration process of Outlook PST file to PDF. Kernel for Outlook to PDF tool can convert Outlook emails with all attributes like Subject, To, From, Cc, Bcc and other folders such as Inbox, Outbox, Sent Items, Jun…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question