I need a way in which I can define the column type at run-time.
Here is my code:
foreach (DataGridViewColumn column in this.dataGrid.Columns)
{
???
//i.e. column.type = checkbox
}
How can I define the column type in this foreach loop?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not 100% certain I understand you question, but you can specify the column type when you create the column:
If you need to change the type once it’s been created – you can’t do that. The best you can do is delete the columns and recreate them with the new types.