Click here to Skip to main content
16,006,535 members
Home / Discussions / C#
   

C#

 
GeneralDateTimePicker in Datagrid Pin
deep715-Aug-05 17:57
deep715-Aug-05 17:57 
GeneralRe: DateTimePicker in Datagrid Pin
Alomgir Miah16-Aug-05 3:43
Alomgir Miah16-Aug-05 3:43 
GeneralRe: DateTimePicker in Datagrid Pin
deep716-Aug-05 20:52
deep716-Aug-05 20:52 
GeneralRe: DateTimePicker in Datagrid Pin
Alomgir Miah17-Aug-05 5:39
Alomgir Miah17-Aug-05 5:39 
Generalstil having csc.exe problems Pin
Heinz_15-Aug-05 17:49
Heinz_15-Aug-05 17:49 
GeneralRe: stil having csc.exe problems Pin
Vasudevan Deepak Kumar15-Aug-05 18:55
Vasudevan Deepak Kumar15-Aug-05 18:55 
GeneralRe: stil having csc.exe problems Pin
Guffa15-Aug-05 18:57
Guffa15-Aug-05 18:57 
Generalruntime compile problem Pin
sduhd15-Aug-05 16:36
sduhd15-Aug-05 16:36 
I have several self-contained C# samples, and I want to show them run to students in class. So I wrote a program, in which I opened the source file, and then ....

Microsoft.CSharp.CSharpCodeProvider cp
= new Microsoft.CSharp.CSharpCodeProvider();
System.CodeDom.Compiler.ICodeCompiler ic = cp.CreateCompiler();
System.CodeDom.Compiler.CompilerParameters cpar
= new System.CodeDom.Compiler.CompilerParameters();
cpar.ReferencedAssemblies.Add("system.dll");
string src = this.textBox1.Text;
System.CodeDom.Compiler.CompilerResults cr = ic.CompileAssemblyFromSource(cpar,src);
foreach (System.CodeDom.Compiler.CompilerError ce in cr.Errors)
MessageBox.Show(ce.ErrorText);

if (cr.Errors.Count == 0 && cr.CompiledAssembly != null)
{
Type ObjType = cr.CompiledAssembly.GetType(classname);
try
{
if (ObjType != null)
{
string[] arguments={};
myobj = Activator.CreateInstance(ObjType);
ObjType.InvokeMember("Main", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Static|BindingFlags.IgnoreCase, null, null, arguments);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return true;
}

My problem is when I run it, I always catch the exception MissingMethodException, i.e. the method "Main" cannot be found.
In textBox2, I input "P2_1.FirstProgram", that's the class which hosted the method "Main".
I guess the "ObjType.InvokeMember" caused the problem, but MSDN did not tell me how to do clearly.
Help!!!!!Confused | :confused:
QuestionDo timers run out ? Pin
Christian Graus15-Aug-05 15:38
protectorChristian Graus15-Aug-05 15:38 
AnswerRe: Do timers run out ? Pin
S. Senthil Kumar15-Aug-05 23:49
S. Senthil Kumar15-Aug-05 23:49 
GeneralRe: Do timers run out ? Pin
Christian Graus16-Aug-05 13:21
protectorChristian Graus16-Aug-05 13:21 
GeneralRe: Do timers run out ? Pin
Robert M Greene16-Aug-05 15:05
Robert M Greene16-Aug-05 15:05 
GeneralRe: Do timers run out ? Pin
Christian Graus16-Aug-05 15:18
protectorChristian Graus16-Aug-05 15:18 
GeneralRe: Do timers run out ? Pin
Robert M Greene16-Aug-05 15:25
Robert M Greene16-Aug-05 15:25 
GeneralRe: Do timers run out ? Pin
Christian Graus16-Aug-05 15:29
protectorChristian Graus16-Aug-05 15:29 
GeneralRe: Do timers run out ? Pin
S. Senthil Kumar16-Aug-05 19:41
S. Senthil Kumar16-Aug-05 19:41 
GeneralRe: Do timers run out ? Pin
Christian Graus16-Aug-05 19:44
protectorChristian Graus16-Aug-05 19:44 
GeneralRe: Do timers run out ? Pin
S. Senthil Kumar17-Aug-05 1:01
S. Senthil Kumar17-Aug-05 1:01 
GeneralRe: Do timers run out ? Pin
Christian Graus17-Aug-05 11:43
protectorChristian Graus17-Aug-05 11:43 
Questionhow to pass data that i get from another computer to my database instead of to a text file? Pin
nidhelp15-Aug-05 15:24
nidhelp15-Aug-05 15:24 
AnswerRe: how to pass data that i get from another computer to my database instead of to a text file? Pin
Christian Graus15-Aug-05 15:30
protectorChristian Graus15-Aug-05 15:30 
QuestionAppDomain.Unload() doesn't release assemblies? Pin
EssOEss15-Aug-05 11:43
EssOEss15-Aug-05 11:43 
AnswerRe: AppDomain.Unload() doesn't release assemblies? Pin
S. Senthil Kumar15-Aug-05 23:53
S. Senthil Kumar15-Aug-05 23:53 
GeneralRe: AppDomain.Unload() doesn't release assemblies? Pin
EssOEss16-Aug-05 5:25
EssOEss16-Aug-05 5:25 
GeneralRe: AppDomain.Unload() doesn't release assemblies? Pin
S. Senthil Kumar16-Aug-05 5:34
S. Senthil Kumar16-Aug-05 5:34 

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.