for (int i = 0; i < applicationDataGridView.Rows.Count; i++)
{
string[] Jobs = { "Network Engineer", "Financial Analyst", "Accountant", "Payroll Administrator", "Accountant Manager", "Sales Consultant" };
if (!applicationDataGridView.Rows[i].IsNewRow)
{
if (applicationDataGridView[4, i].Value.ToString() != Jobs)
{
applicationDataGridView.Rows.RemoveAt(i);
i--;
}
}
}
Above is the code that I have tried but It does not work. I want to delete the rows that doesn't contain the values in "Jobs" which I have assigned as a string. The Job column is column "4".

Sachin SinghRank #66 · 26.2K reputationPosted Oct 27, 2021, 2:03 AM EDT
Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Oct 27, 2021, 12:42 AM EDT
Don’t delete the records in the grid. Delete the rows or columns in dataset or data table and rebind to gridview
Kirtesh ShahRank #250 · 10K reputationPosted Oct 27, 2021, 12:52 AM EDT
Samuel Toh127 reputationPosted Oct 27, 2021, 1:25 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Oct 27, 2021, 1:29 AM EDT
Samuel Toh127 reputationPosted Oct 27, 2021, 1:30 AM EDT
Samuel Toh127 reputationPosted Oct 27, 2021, 1:33 AM EDT
Kirtesh ShahRank #250 · 10K reputationPosted Oct 27, 2021, 1:38 AM EDT
Samuel Toh127 reputationPosted Oct 27, 2021, 1:44 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Oct 27, 2021, 1:49 AM EDT
Samuel Toh127 reputationPosted Oct 27, 2021, 1:54 AM EDT
Samuel Toh127 reputationPosted Oct 27, 2021, 2:07 AM EDT
Kirtesh ShahRank #250 · 10K reputationPosted Oct 27, 2021, 1:21 AM EDT