Click here to Skip to main content
15,921,694 members
Home / Discussions / C#
   

C#

 
AnswerRe: Flickering-free!! Pin
leppie19-May-06 7:06
leppie19-May-06 7:06 
AnswerRe: Flickering-free!! Pin
Josh Smith19-May-06 7:13
Josh Smith19-May-06 7:13 
AnswerRe: Flickering-free!! Pin
Sirinao19-May-06 9:08
Sirinao19-May-06 9:08 
QuestionCreating a Vitual Drive Pin
Gonzalo Brusella19-May-06 5:26
Gonzalo Brusella19-May-06 5:26 
AnswerRe: Creating a Vitual Drive Pin
leppie19-May-06 7:14
leppie19-May-06 7:14 
GeneralRe: Creating a Vitual Drive Pin
Gonzalo Brusella19-May-06 7:19
Gonzalo Brusella19-May-06 7:19 
GeneralRe: Creating a Vitual Drive Pin
Dario Solera19-May-06 9:05
Dario Solera19-May-06 9:05 
Questionobject.GetType() -=Part II=- Pin
CombatRob19-May-06 5:00
CombatRob19-May-06 5:00 
Thanks to everyone who helped with my previous question. I soon realized, however, that what I really need to do is to be able to cast the type, such as:

- This code is hypothetical, as to not complicate things further, but the real object in the program I am working on is a crystal report, but I want the viewer to work with any crystal report without having to hard code the viewer each time I create a new report. But if someone was able to answer this question, I could take it from there.

object SomeFunction ()<br />
{<br />
// Code to create an object of an unknown type<br />
return UnknownObject;<br />
}


Now, while I dont know exactly what type UnknownObject is, I am sure no matter what it has a method called, lets say, ClearNum() - ya, kind of stupid, but Im trying to keep it simple to try to avoid getting an overcomplicated answer.

So lets say I want to ClearNum() on the object regardless of what type of object it is.
How can I accomplish the following:

void OnFormClose ()<br />
{<br />
object o = SomeFunction();<br />
((o.GetType())o).ClearNum();  // Why can't casting be this simple<br />
}



Thanks if anyone knows the answer It would help me be a much better programmer.

AnswerRe: object.GetType() -=Part II=- Pin
Josh Smith19-May-06 5:04
Josh Smith19-May-06 5:04 
GeneralRe: object.GetType() -=Part II=- Pin
CombatRob19-May-06 5:52
CombatRob19-May-06 5:52 
Questionquestion about arrays Pin
donkaiser19-May-06 4:55
donkaiser19-May-06 4:55 
AnswerRe: question about arrays Pin
Kevin McFarlane19-May-06 5:20
Kevin McFarlane19-May-06 5:20 
GeneralRe: question about arrays Pin
donkaiser19-May-06 5:22
donkaiser19-May-06 5:22 
GeneralRe: question about arrays Pin
J4amieC19-May-06 5:23
J4amieC19-May-06 5:23 
GeneralRe: question about arrays Pin
Josh Smith19-May-06 5:23
Josh Smith19-May-06 5:23 
GeneralRe: question about arrays Pin
donkaiser19-May-06 6:03
donkaiser19-May-06 6:03 
GeneralRe: question about arrays Pin
Josh Smith19-May-06 7:09
Josh Smith19-May-06 7:09 
GeneralRe: question about arrays Pin
leppie19-May-06 7:10
leppie19-May-06 7:10 
AnswerRe: question about arrays Pin
J4amieC19-May-06 5:22
J4amieC19-May-06 5:22 
GeneralRe: question about arrays Pin
donkaiser19-May-06 5:26
donkaiser19-May-06 5:26 
AnswerRe: question about arrays Pin
donkaiser22-May-06 8:00
donkaiser22-May-06 8:00 
QuestionUrgent: Type casting String Property to String type Pin
kumar.bs19-May-06 4:47
kumar.bs19-May-06 4:47 
AnswerRe: Urgent: Type casting String Property to String type Pin
Josh Smith19-May-06 5:01
Josh Smith19-May-06 5:01 
AnswerRe: Urgent: Type casting String Property to String type Pin
kumar.bs19-May-06 5:06
kumar.bs19-May-06 5:06 
GeneralRe: Urgent: Type casting String Property to String type Pin
Josh Smith19-May-06 5:22
Josh Smith19-May-06 5:22 

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.