Click here to Skip to main content
13,559,528 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

Do you know how to fix this?

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

Thank you!
Posted 17-Jan-13 20:01pm
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 .
SAKryukov 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.
SAKryukov 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.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180527.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100