Click here to Skip to main content
15,913,773 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get children of a TreeNode ? Pin
CPallini7-Jan-07 23:36
mveCPallini7-Jan-07 23:36 
QuestionHow to know Store procedure Input and OutPut Parameters through programs Pin
indiaone3-Jan-07 19:58
indiaone3-Jan-07 19:58 
AnswerRe: How to know Store procedure Input and OutPut Parameters through programs Pin
Michael P Butler3-Jan-07 22:35
Michael P Butler3-Jan-07 22:35 
GeneralRe: How to know Store procedure Input and OutPut Parameters through programs Pin
Seishin#3-Jan-07 22:12
Seishin#3-Jan-07 22:12 
QuestionWhy just get NULL return from excel oledb Pin
remex_1980_junyongwu3-Jan-07 19:49
remex_1980_junyongwu3-Jan-07 19:49 
AnswerRe: Why just get NULL return from excel oledb Pin
remex_1980_junyongwu3-Jan-07 19:51
remex_1980_junyongwu3-Jan-07 19:51 
QuestionRuntime form Object Reference Pin
vaibhavnvag3-Jan-07 19:26
vaibhavnvag3-Jan-07 19:26 
AnswerRe: Runtime form Object Reference Pin
Martin#3-Jan-07 20:07
Martin#3-Jan-07 20:07 
Hello,

What you asked for is not possible!

.)
If you know all the possible class names during design time, you simple could make a switch case over the returned string.

string myform = actual_returned_string;

switch(myform)
{
    case "test1":
    {
        MyTest1 t1 = new MyTest1();
	break;
    }
 
    case "test2":
    {
	MyTest2 t1 = new MyTest2();
	break;
    }
 
    default:
	break;
}


.)
If you have to make it more dynamic, then you have to look into reflection.
Therefore you should know the namespace of youre formclasses.

You could use a method like this, which returns you a Form to Show.

using System.Reflection;
 
public System.Windows.Forms.Form GetFormByName(string _name)
{
    Type t = Type.GetType(_name);
    if (t != null)
    {
	ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);
	Object o = c.Invoke(new Object[0]);
	return o as System.Windows.Forms.Form;
    }
    else
    {
	return null;
    }
}



And you can call it like that:

string namespace = //???
string myform = namespace+actual_returned_string;
 
System.Windows.Forms.Form actForm = GetFormByName(myform);


Hope it works for you!

All the best,

Martin
GeneralRe: Runtime form Object Reference Pin
Colin Angus Mackay3-Jan-07 23:50
Colin Angus Mackay3-Jan-07 23:50 
GeneralRe: Runtime form Object Reference Pin
Martin#4-Jan-07 0:06
Martin#4-Jan-07 0:06 
GeneralRe: Runtime form Object Reference Pin
ednrgc4-Jan-07 2:15
ednrgc4-Jan-07 2:15 
GeneralRe: Runtime form Object Reference Pin
Colin Angus Mackay4-Jan-07 8:07
Colin Angus Mackay4-Jan-07 8:07 
QuestionDetecting sql server and db2 Pin
saqib823-Jan-07 19:12
saqib823-Jan-07 19:12 
AnswerRe: Detecting sql server and db2 Pin
ednrgc4-Jan-07 2:20
ednrgc4-Jan-07 2:20 
QuestionDockpanel with Form as UIElement Pin
GunaChinna3-Jan-07 18:17
GunaChinna3-Jan-07 18:17 
Questioncopying a reference Pin
swjam3-Jan-07 16:07
swjam3-Jan-07 16:07 
AnswerRe: copying a reference Pin
Phillip M. Hoff3-Jan-07 17:32
Phillip M. Hoff3-Jan-07 17:32 
Question"Mixing" events? Pin
Lord Kixdemp3-Jan-07 15:46
Lord Kixdemp3-Jan-07 15:46 
QuestionRegex.Replace Question Pin
DevinG3-Jan-07 15:33
DevinG3-Jan-07 15:33 
AnswerRe: Regex.Replace Question Pin
ednrgc4-Jan-07 2:59
ednrgc4-Jan-07 2:59 
GeneralRe: Regex.Replace Question Pin
DevinG4-Jan-07 6:53
DevinG4-Jan-07 6:53 
GeneralRe: Regex.Replace Question Pin
ednrgc4-Jan-07 6:56
ednrgc4-Jan-07 6:56 
GeneralRe: Regex.Replace Question Pin
DevinG4-Jan-07 7:43
DevinG4-Jan-07 7:43 
GeneralRe: Regex.Replace Question Pin
ednrgc4-Jan-07 8:17
ednrgc4-Jan-07 8:17 
AnswerRe: Regex.Replace Question Pin
ednrgc4-Jan-07 3:20
ednrgc4-Jan-07 3:20 

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.