Reputation: 1598
I have a form created which an unbound datagridview that has three columns. "Position", "ID", "Name". The data is being added at runtime into a database upon the forms completion. (I don't want to add unnecessary rows to the database in the event a person clicks Cancel.)
What I need to do is on the deletion of a row in the datagridview, search through the rows "Position" for a "HJ" value. If it's not found, change the "Position" value of the first row to be "HJ".
Here's a photo of what I mean:
I've already taken care of the "Add Judge" button. The "Make Head Judge" button I guess will be on another question.
EDIT: Code removed, not needed since I found a function to search through a datagridview for me.
I found information about FirstDisplayedScrollingRowIndex
but I can't seem to get it to work for some reason. Any assistance is greatly appreciated.
Upvotes: 0
Views: 1346
Reputation: 38
I would add a hidden column "rank" which could be used to sort the grid. Enumerate each of your ranks: HeadJudge = 0, AsstHeadJudge = 1, Judge = 2. If you will only have one head judge, then sorting by rank will always place the HeadJudge in the first row.
Upvotes: 1