¬Hi there,

I have a quaetion in datagrid view.
In datagridview I have add a constaint and if the user didn’t meet the reuirment I add an error text. Which shown below

if (c == 2)     
                {
                    MessageBox.Show("Cannot select the file name","Message",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                    dgvForm.Rows[e.RowIndex].ErrorText = "Cannot select the file name";
                    e.Cancel = true;
                    return;
                }       
                else
                    dgvForm.Rows[e.RowIndex].ErrorText = string.Empty;

but when I try to delete that row it donse’t give me to delete the unless I correct that error. How can I avoid that and meake the orw to be deleted?

how can i avoid this situation??

please can i get some guidance on this
thanxxxxxx

If I understand you, you would like to delete rows. If all the requirements (WHICH ONE??) aren`t meat, the user is unable to delete selected row and the error message pops up.
But what I do not understand is what is wrong with the code - so would you be so kind, and past it here some more of your code, to actually see whats wrong with it - any maybe some better explanation would be weclome as well.
thx
mitja

If I understand you, you would like to delete rows. If all the requirements (WHICH ONE??) aren`t meat, the user is unable to delete selected row and the error message pops up.
But what I do not understand is what is wrong with the code - so would you be so kind, and past it here some more of your code, to actually see whats wrong with it - any maybe some better explanation would be weclome as well.
thx
mitja

so in the datagridview first column if the user enters the same name twise the above mentioned error message will appear. so then when the user tries to delete that row he can't because of the error text, so every time the user makes that mistake he has to correct it to delete that row,

what i was telling was without correcting the mistake how can i make the user delete the error text row???

did you get it??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.