473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Kind of Eval needed

How can I do this in Csharp

private void applyColor(Control ctr, string oProperty, Color newVal)
{
ctr.oProperty= newVal;
}

Need to Evaluate (ctr.oProperty) so the program understand for example
(this.Button1.BackColor = newVal)

Than you for your help
Nov 15 '05 #1
2 1037
Hi,

Of course you can do it using reflection:

ctr.GetType().GetProperty(oProperty).SetValue( ctr,newVal, null);

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nicolas" <nl*****@hotmail.com> wrote in message
news:OK****************@TK2MSFTNGP10.phx.gbl...
How can I do this in Csharp

private void applyColor(Control ctr, string oProperty, Color newVal)
{
ctr.oProperty= newVal;
}

Need to Evaluate (ctr.oProperty) so the program understand for example
(this.Button1.BackColor = newVal)

Than you for your help

Nov 15 '05 #2
Thank a billion

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:ew**************@tk2msftngp13.phx.gbl...
Hi,

Of course you can do it using reflection:

ctr.GetType().GetProperty(oProperty).SetValue( ctr,newVal, null);

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nicolas" <nl*****@hotmail.com> wrote in message
news:OK****************@TK2MSFTNGP10.phx.gbl...
How can I do this in Csharp

private void applyColor(Control ctr, string oProperty, Color newVal)
{
ctr.oProperty= newVal;
}

Need to Evaluate (ctr.oProperty) so the program understand for example
(this.Button1.BackColor = newVal)

Than you for your help


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: HikksNotAtHome | last post by:
This is a very simplified example of an Intranet application. But, is there an easier (or more efficient) way of getting the decimal equivalent of a fraction? The actual function gets the select...
7
by: Reply Via Newsgroup | last post by:
This might sound sad... someone requesting a disertation on the 'eval' statement... but... I've been reading someone else's post - they had a huge calander like script and a handful of folk cursed...
11
by: sneill | last post by:
I have read a number of posts on the use of eval() in Javascript, and I agree that its use is questionable. But it does beg the following question: "How arbitrary does a string need to be before...
7
by: steveneill | last post by:
Is this an alternative to eval(). Admittidly, I have done *very* little testing (ran it a few times in Firefox), but it seemed to work suprisingly well with simple expressions such as...
18
by: Joe Fallon | last post by:
I have some complex logic which is fairly simply to build up into a string. I needed a way to Eval this string and return a Boolean result. This code works fine to achieve that goal. My...
4
by: niko.nyman | last post by:
I noticed weird results when using eval() to do some simple calculations. Here are a few eval() statements and the corresponding results from JavaScript: eval("1.2+0.97") =2.17 eval("1.2+0.98")...
8
by: fredo | last post by:
This question was asked in comp.lang.javascript with no result. In IE5.x and IE6, I want to display an image when the user rolls over a text link. The image does indeed display, but only on the...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
2
by: emmettnicholas | last post by:
Hi, I realize that eval() is generally discouraged, but I've found myself wishing that I could execute user-generated code. One idea I've seen is to use token_get_all(), and then make sure no...
3
by: James Mills | last post by:
On Thu, Oct 9, 2008 at 2:26 PM, Warren DeLano <warren@delsci.comwrote: Yes it does :) I second this. It's far better to use Data Structures rather than Programming Constructs
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.