Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
1.75/5 (4 votes)
See more:
Hi All,

Do you know how to fix this?

Error:
Unable to cast object of type 'System.Windows.Forms.DataGridViewTextBoxCell' to type 'System.Windows.Forms.Control'.


Thank you!
Posted
Comments
codejet 18-Jan-13 2:11am    
How about giving us more info on what you are trying to do? Throw me a bone , I'm the boss, need the info .
Sergey Alexandrovich Kryukov 18-Jan-13 2:20am    
Of course you cannot cast it, because cell is not Control. Who told you it is?
You should not "fix" it; you should not do it at all.
—SA
Sergey Alexandrovich Kryukov 18-Jan-13 2:26am    
And please stop posting your fake answers ("I got it", and the like). I removed all of them but one.

"Add your solution here" is reserved for the cases when you at least try to provide some help, in response to some question. Doing so will bring your nothing but down-voted and abuse reports. You don't want it, so I only helped you by removing them. Several more heavy abusers already lost their membership account because of their abuse.

Thank you for understanding.
—SA

1 solution

Look at the inheritance table for this class[^]. The DataGridViewTextBoxCell does not inherit from Control so you cannot cast it so.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900