Click here to Skip to main content
15,909,829 members
Home / Discussions / C#
   

C#

 
AnswerRe: Hard Inheritance Questions (for me) Pin
PIEBALDconsult22-Jul-08 14:32
mvePIEBALDconsult22-Jul-08 14:32 
AnswerRe: Hard Inheritance Questions (for me) Pin
Dirso22-Jul-08 16:34
Dirso22-Jul-08 16:34 
AnswerRe: Hard Inheritance Questions (for me) Pin
Giorgi Dalakishvili22-Jul-08 21:32
mentorGiorgi Dalakishvili22-Jul-08 21:32 
GeneralRe: Hard Inheritance Questions (for me) Pin
Dirso23-Jul-08 3:50
Dirso23-Jul-08 3:50 
GeneralRe: Hard Inheritance Questions (for me) Pin
Giorgi Dalakishvili23-Jul-08 4:44
mentorGiorgi Dalakishvili23-Jul-08 4:44 
QuestionLockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 12:39
gigahertz20522-Jul-08 12:39 
AnswerRe: Lockbits and 8-bit grayscale images Pin
Guffa22-Jul-08 13:39
Guffa22-Jul-08 13:39 
GeneralRe: Lockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 15:26
gigahertz20522-Jul-08 15:26 
GeneralRe: Lockbits and 8-bit grayscale images Pin
Luc Pattyn22-Jul-08 15:42
sitebuilderLuc Pattyn22-Jul-08 15:42 
GeneralRe: Lockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 15:50
gigahertz20522-Jul-08 15:50 
GeneralRe: Lockbits and 8-bit grayscale images Pin
Guffa23-Jul-08 4:33
Guffa23-Jul-08 4:33 
QuestionOpen (or focus) forms from listbox items Pin
nelsonpaixao22-Jul-08 12:34
nelsonpaixao22-Jul-08 12:34 
AnswerRe: Open (or focus) forms from listbox items Pin
Luc Pattyn22-Jul-08 13:29
sitebuilderLuc Pattyn22-Jul-08 13:29 
AnswerRe: Open (or focus) forms from listbox items Pin
nelsonpaixao23-Jul-08 14:06
nelsonpaixao23-Jul-08 14:06 
Questiondata insert mysql+c# Pin
SHINOJK22-Jul-08 12:09
SHINOJK22-Jul-08 12:09 
AnswerRe: data insert mysql+c# Pin
Dirso22-Jul-08 12:30
Dirso22-Jul-08 12:30 
GeneralRe: data insert mysql+c# Pin
Mbah Dhaim22-Jul-08 23:37
Mbah Dhaim22-Jul-08 23:37 
QuestionYet another multi-threading question... Pin
DavidBoyd22-Jul-08 11:58
DavidBoyd22-Jul-08 11:58 
Questionpivot table control in c# Pin
Shuaib wasif khan22-Jul-08 11:46
Shuaib wasif khan22-Jul-08 11:46 
AnswerRe: pivot table control in c# Pin
Vimalsoft(Pty) Ltd22-Jul-08 12:03
professionalVimalsoft(Pty) Ltd22-Jul-08 12:03 
GeneralRe: pivot table control in c# Pin
PIEBALDconsult22-Jul-08 12:10
mvePIEBALDconsult22-Jul-08 12:10 
AnswerRe: pivot table control in c# Pin
Guffa22-Jul-08 12:22
Guffa22-Jul-08 12:22 
monu_khan wrote:
axPivotTable1.DataSource=(msdatasrc.DataSource)(object)dt;


You can't cast an object to something that it isn't. You can only cast an object to it's actual class, any of it's base classes, or any of the interfaces that it implements.

C# is type safe, so the object contains information about it's actual type. When you do a cast, you cast the reference, but the object still remains the same type. Therefore, when you cast the DataTable reference to object, you get an object reference pointing to a DataTable object. You can't then cast this to msdatasrc.DataSource, as the actual type of the object does not inherit that class.

If the control can't use a DataTable as data source, you have to copy the data from the DataTable into something that the control can use.

Despite everything, the person most likely to be fooling you next is yourself.

QuestionCreate a file chooser. Pin
AgroDuck22-Jul-08 11:32
AgroDuck22-Jul-08 11:32 
AnswerRe: Create a file chooser. Pin
Vimalsoft(Pty) Ltd22-Jul-08 11:56
professionalVimalsoft(Pty) Ltd22-Jul-08 11:56 
AnswerRe: Create a file chooser. Pin
PIEBALDconsult22-Jul-08 12:13
mvePIEBALDconsult22-Jul-08 12:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.