Click here to Skip to main content
15,888,802 members
Home / Discussions / C#
   

C#

 
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 
Questionsocket programming Pin
AlexPizzano22-Jul-08 11:28
AlexPizzano22-Jul-08 11:28 
AnswerRe: socket programming Pin
DavidBoyd22-Jul-08 11:47
DavidBoyd22-Jul-08 11:47 
GeneralRe: socket programming Pin
AlexPizzano22-Jul-08 11:50
AlexPizzano22-Jul-08 11:50 
AnswerRe: socket programming Pin
nelsonpaixao22-Jul-08 12:22
nelsonpaixao22-Jul-08 12:22 
QuestionBlocking Input Pin
Dirso22-Jul-08 11:15
Dirso22-Jul-08 11:15 
AnswerRe: Blocking Input Pin
Vimalsoft(Pty) Ltd22-Jul-08 11:53
professionalVimalsoft(Pty) Ltd22-Jul-08 11:53 
GeneralRe: Blocking Input Pin
Dirso22-Jul-08 12:26
Dirso22-Jul-08 12:26 
Questiondata binding to combobox Pin
bfis10813722-Jul-08 10:58
bfis10813722-Jul-08 10:58 
AnswerRe: data binding to combobox Pin
Vimalsoft(Pty) Ltd22-Jul-08 11:43
professionalVimalsoft(Pty) Ltd22-Jul-08 11:43 
GeneralRe: data binding to combobox Pin
bfis10813723-Jul-08 3:08
bfis10813723-Jul-08 3:08 
GeneralRe: data binding to combobox Pin
Vimalsoft(Pty) Ltd23-Jul-08 5:45
professionalVimalsoft(Pty) Ltd23-Jul-08 5:45 
GeneralRe: data binding to combobox Pin
bfis10813723-Jul-08 5:53
bfis10813723-Jul-08 5:53 
QuestionReady screen for a simple game Pin
Gareth H22-Jul-08 10:46
Gareth H22-Jul-08 10:46 
AnswerRe: Ready screen for a simple game Pin
DaveyM6922-Jul-08 10:56
professionalDaveyM6922-Jul-08 10:56 

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.