Click here to Skip to main content
15,920,468 members
Home / Discussions / C#
   

C#

 
GeneralRe: Previewing MP4 file Pin
N a v a n e e t h25-Feb-08 15:20
N a v a n e e t h25-Feb-08 15:20 
Generalc# call fortran dll,stack overflow Pin
wenshengluo24-Feb-08 19:42
wenshengluo24-Feb-08 19:42 
GeneralRe: c# call fortran dll,stack overflow Pin
Christian Graus24-Feb-08 19:58
protectorChristian Graus24-Feb-08 19:58 
GeneralRe: c# call fortran dll,stack overflow Pin
wenshengluo25-Feb-08 13:55
wenshengluo25-Feb-08 13:55 
GeneralApplication does not run on Laptops Pin
rozhanin24-Feb-08 19:39
rozhanin24-Feb-08 19:39 
GeneralRe: Application does not run on Laptops Pin
Christian Graus24-Feb-08 19:56
protectorChristian Graus24-Feb-08 19:56 
GeneralRe: Application does not run on Laptops Pin
rozhanin25-Feb-08 0:44
rozhanin25-Feb-08 0:44 
Question(C#) Is there something like GetObjectInstanceByName("myObj1")?? Pin
zeopyrix24-Feb-08 19:26
zeopyrix24-Feb-08 19:26 
Hello I'm working on a semi-script engine (using Reflection) and I have this class:

<code>
public enum LogicalOperator { EQL, NEQ, GTR, LSS, LEQ, GEQ };
public class Condition
{
public string instancename, fieldname;
public LogicalOperator logic;
public object value;
public Condition(string instancename, string fieldname, LogicalOperator logic, object value)
{
this.instancename = instancename;
this.fieldname = fieldname;
this.logic = logic;
this.value = value;
}
public Condition()
{
}
public bool Eval(object target)
{
object myValue = null;
try
{
myValue = target.GetType().GetField(this.fieldname).GetValue(target);
if (myValue == null)
{
myValue = target.GetType().GetProperty(this.fieldname).GetValue(target, null);
}
switch (this.logic)
{
case LogicalOperator.EQL: return myValue == this.value;
case LogicalOperator.NEQ: return myValue != this.value;
case LogicalOperator.GTR: return (float)myValue &gt; (float)this.value;
case LogicalOperator.LSS: return (float)myValue &lt; (float)this.value;
case LogicalOperator.LEQ: return (float)myValue &lt;= (float)this.value;
case LogicalOperator.GEQ: return (float)myValue &gt;= (float)this.value;
default: return false;
}
}
catch (NullReferenceException)
{
return false;
}
}
}
</code>

This works fine, but the problem is that I need some function like <i>GetObjectInstanceByName(this.instancename</i>), where instancename is a string and the return value is the instance as object.

I.e.: <i>Button myButton = GetObjectInstanceByName("Form1.button1") as Button;</i>

I've been surfering the net but I've don't found anything. How can I do this?

Thanks
AnswerRe: (C#) Is there something like GetObjectInstanceByName("myObj1")?? Pin
Christian Graus24-Feb-08 19:59
protectorChristian Graus24-Feb-08 19:59 
GeneralRe: (C#) Is there something like GetObjectInstanceByName("myObj1")?? Pin
zeopyrix24-Feb-08 20:06
zeopyrix24-Feb-08 20:06 
GeneralRe: (C#) Is there something like GetObjectInstanceByName("myObj1")?? Pin
Christian Graus24-Feb-08 20:14
protectorChristian Graus24-Feb-08 20:14 
Questionproblem while retriving image from database. [modified] Pin
avvaru.murali24-Feb-08 19:24
avvaru.murali24-Feb-08 19:24 
GeneralRe: problem while image from database. Pin
Christian Graus24-Feb-08 19:32
protectorChristian Graus24-Feb-08 19:32 
QuestionRe: problem while retrving image from database. Pin
avvaru.murali24-Feb-08 19:40
avvaru.murali24-Feb-08 19:40 
GeneralRe: problem while retrving image from database. Pin
Christian Graus24-Feb-08 20:00
protectorChristian Graus24-Feb-08 20:00 
AnswerRe: problem while image from database. Pin
zeopyrix24-Feb-08 19:39
zeopyrix24-Feb-08 19:39 
GeneralRe: problem while retriving image from database. Pin
Giorgi Dalakishvili24-Feb-08 20:18
mentorGiorgi Dalakishvili24-Feb-08 20:18 
GeneralExecuting SSis package from C# Pin
tasumisra24-Feb-08 19:18
tasumisra24-Feb-08 19:18 
Questionindeterminate progress bar Pin
veerbala24-Feb-08 18:57
veerbala24-Feb-08 18:57 
GeneralRe: indeterminate progress bar Pin
Christian Graus24-Feb-08 19:08
protectorChristian Graus24-Feb-08 19:08 
QuestionUnique random numbers Pin
D i x y24-Feb-08 18:55
D i x y24-Feb-08 18:55 
GeneralRe: Unique random numbers Pin
Christian Graus24-Feb-08 19:07
protectorChristian Graus24-Feb-08 19:07 
GeneralRe: Unique random numbers Pin
D i x y24-Feb-08 19:52
D i x y24-Feb-08 19:52 
GeneralRe: Unique random numbers Pin
Christian Graus24-Feb-08 20:16
protectorChristian Graus24-Feb-08 20:16 
GeneralHold the timer tick event before processing Pin
CodingLover24-Feb-08 18:26
CodingLover24-Feb-08 18:26 

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.