Click here to Skip to main content
15,916,379 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai all,
how to convert object type data to DataGridViewcell type data..?
Posted

1 solution

You probably can't - not unless it was actually a DataGridViewCell (or derived class) instance in teh first place. You can check with the is and as keywords:
if (myObject is DataGridViewCell)
   {
   ...
   }
or
DataGridViewCell dgvc = myObject as DataGridViewCell;
if (dgvc != null)
   {
   ...
   }
If you are trying to put an object into a DataGridView and need a new cell to hold it though, create a new cell object and set it's properties appropriately for the object type you are trying to handle.

Sorry if that sounds a bit vague, but you didn't give us much to start with...
 
Share this answer
 
Comments
Ankur\m/ 21-May-11 5:31am    
Perfect, 5!
Sanjay J Patolia 21-May-11 7:47am    
What if we use dynamic type instead of object type??

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