Hi,
I am getting the error as Column name not found in following line:
if (Convert.ToBoolean(DGVOPDProc["Assign", i].EditedFormattedValue))
Where DGVOPDProc is the name of my Data Grid View Control and Assign is the column name.
on this basis i want to insert data in my table, can anyone have any other idea or can anyone have any idea to resolve this.
Thanks.
Error in Data Grid View.
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Piyush PansuriyaRank #454 · 5.5K reputationPosted Jan 8, 2015, 9:41 PM EST
Can I know what is "i" in your if condition?
if you put your full method, so i can suggest..
Posted Jan 8, 2015, 9:48 PM EST
Following is my code :
for (int i = 0; i < DGVOPDProc.Rows.Count; i++)
{
if (Convert.ToBoolean(DGVOPDProc["Assign", i].EditedFormattedValue))
{
//Code for inserting the values selected in Grid View.
}
}
i is nothing but an integer variable. Assign is an CheckBoxControl Column in Data Grid View.
Piyush PansuriyaRank #454 · 5.5K reputationPosted Jan 8, 2015, 10:51 PM EST
If you want to get column than :
DataGridViewColumn DGCol = DGVOPDProc.Columns["Assign"]; Now you can use DGCol variable for your further codePosted Jan 9, 2015, 7:14 AM EST
Thanks @Piyush Sir.your suggestion is correct at its place.
Piyush PansuriyaRank #454 · 5.5K reputationPosted Jan 9, 2015, 6:10 PM EST
Than accept as correct answer.!!