Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
QuestionThread reach synchronized code block Pin
FJJCENTU21-Sep-09 6:33
FJJCENTU21-Sep-09 6:33 
AnswerRe: Thread reach synchronized code block Pin
N a v a n e e t h21-Sep-09 7:01
N a v a n e e t h21-Sep-09 7:01 
Question[SOLVED] File Encryption Broken [modified] Pin
Ben Magee21-Sep-09 6:26
Ben Magee21-Sep-09 6:26 
NewsRe: File Encryption Broken Pin
Ben Magee21-Sep-09 6:41
Ben Magee21-Sep-09 6:41 
QuestionPlease help me about working with Word - Very URGENT Pin
designervc21-Sep-09 6:18
designervc21-Sep-09 6:18 
QuestionSocket programming problem Pin
JLP18821-Sep-09 6:07
JLP18821-Sep-09 6:07 
QuestionRecovering delivery Errors sending SMTP Mails Pin
FJJCENTU21-Sep-09 4:14
FJJCENTU21-Sep-09 4:14 
QuestionCreate a delegate at run time Pin
bonzaiholding21-Sep-09 2:50
bonzaiholding21-Sep-09 2:50 
Hi, I want to let the user to insert a string that will create a function.
I know how to create a class or method at runtime.
I have a delegate and I want the function that the user been created will be stored in the delegate event that i use.
How can I do it?

Specification
The user can select the sorted function that he want's(Sort of some system class).
He gets a list with this functions for example:
1. Area
2. Length
3. Custom
If the user choose Area/length then the list of item that I have (very complex system) will be sorted by Area/Length but if the user choose 'Custom' then I want to show him a new Textbox and then he can write 'Area*Length +COS(Length)'.
This is my delegate:
delegate double GetGrade(SystemD SD);
GetGrade MyGrade;

1. Area:
MyGrade = new GetGrade(AreaGrade);
public double AreaGrade(SystemD SD)
{
return SD.Area;
}


2. Length:
MyGrade = new GetGrade(LengthGrade);
public double LengthGrade(SystemD SD)
{
return SD.Length;
}


3. Custom:
MyGrade = new GetGrade(CustomGrade);
public double CustomGrade(SystemD SD)
{
   string str= CustomTextBox.Text;
   double Grade= CompileAndGetDoubleNumber(str,SD);  //This is the function that i want to implement. 
   // The function that i want gets the string that contain the code for calculation, and SD that represent the system(class instance). It's return the wanted value after the calculation, for example from the string '2*SD.Length+SD.Area' i will get a double that represent the value (2*Length +Area) of SD.
   return Grade;
}

I want to get the string from the user and create at runtime a function that can be overload to this event but I need this function before to compilation because then I can not choose the function for the event because the function does not exists.

What can I do to resolve this problem?

AnswerRe: Create a delegate at run time Pin
Not Active21-Sep-09 4:04
mentorNot Active21-Sep-09 4:04 
QuestionCreating Registry Keys with Setup if key doesn't exist. Pin
Paramhans Dubey21-Sep-09 2:50
professionalParamhans Dubey21-Sep-09 2:50 
AnswerRe: Creating Registry Keys with Setup if key doesn't exist. Pin
Manas Bhardwaj21-Sep-09 3:24
professionalManas Bhardwaj21-Sep-09 3:24 
GeneralRe: Creating Registry Keys with Setup if key doesn't exist. Pin
Paramhans Dubey21-Sep-09 19:06
professionalParamhans Dubey21-Sep-09 19:06 
QuestionReportViewer control problem Pin
firefeet21-Sep-09 1:23
firefeet21-Sep-09 1:23 
AnswerRe: ReportViewer control problem Pin
Abhishek Sur21-Sep-09 11:42
professionalAbhishek Sur21-Sep-09 11:42 
GeneralRe: ReportViewer control problem Pin
firefeet21-Sep-09 18:16
firefeet21-Sep-09 18:16 
QuestionHow to delete outlook appointment Pin
tspradeep198021-Sep-09 1:06
tspradeep198021-Sep-09 1:06 
Questionsplitting values randomly - C# Pin
flower_t21-Sep-09 1:05
flower_t21-Sep-09 1:05 
AnswerRe: splitting values randomly - C# [modified] Pin
Calla21-Sep-09 1:29
Calla21-Sep-09 1:29 
AnswerRe: splitting values randomly - C# Pin
OriginalGriff21-Sep-09 2:46
mveOriginalGriff21-Sep-09 2:46 
AnswerRe: splitting values randomly - C# Pin
flower_t21-Sep-09 2:56
flower_t21-Sep-09 2:56 
GeneralRe: splitting values randomly - C# Pin
harold aptroot21-Sep-09 3:38
harold aptroot21-Sep-09 3:38 
GeneralRe: splitting values randomly - C# Pin
PIEBALDconsult21-Sep-09 7:39
mvePIEBALDconsult21-Sep-09 7:39 
AnswerRe: splitting values randomly - C# Pin
Luc Pattyn21-Sep-09 4:10
sitebuilderLuc Pattyn21-Sep-09 4:10 
AnswerRe: splitting values randomly - C# Pin
PIEBALDconsult21-Sep-09 4:57
mvePIEBALDconsult21-Sep-09 4:57 
GeneralRe: splitting values randomly - C# Pin
Luc Pattyn21-Sep-09 5:40
sitebuilderLuc Pattyn21-Sep-09 5:40 

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.