Is there a way to evaluate an expression passed as a parameter?

  • Thread starter Thread starter Ray Martin
  • Start date Start date
R

Ray Martin

I have created a custom datagridcolumn, and would like to color the cell
based on criteria passed as a parm when the column is created. I would like
this to be generic so I want to do something similar to the Clipper/dBase
function "&", or even the DOTNET Debug.Evaluate methid.

So, for example if I wanted the cell in row 5 to be the one to be colored
differently I could do something like:

mynewcolumn = new colorcolumn(brushes.red,"rownum = 5")

and then inside colorcolumn I could have code like

Private colorcolumn(background as brush, filterstring as string)
if eval(filterstring) then
set background to background
endif
mybase.paint(etc, etc)

What I hope to achieve is that eval(filterstring) will execute at run-time
and produce

if rownum=5 then.....

How can I do this or something similar?
 
* "Ray Martin said:
I have created a custom datagridcolumn, and would like to color the cell
based on criteria passed as a parm when the column is created. I would like
this to be generic so I want to do something similar to the Clipper/dBase
function "&", or even the DOTNET Debug.Evaluate methid.

<http://groups.google.de/[email protected]>

Evaluating mathematical expressions:

<http://www.palmbytes.de/content/dotnet/mathlib.htm>

Using the Script Control (COM):

<http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=535>

C# sample:

<http://www.codeproject.com/useritems/evaluator.asp>
<http://www.codeproject.com/csharp/livecodedotnet.asp>

If you have a DevX account:

<http://www.devx.com/codemag/Article/10352/0/page/1>
 
Back
Top