Click here to Skip to main content
15,902,276 members
Home / Discussions / C#
   

C#

 
AnswerRe: Generic parameter/reflection problem Pin
Pete O'Hanlon10-Jul-07 1:59
mvePete O'Hanlon10-Jul-07 1:59 
GeneralRe: Generic parameter/reflection problem Pin
Bekjong10-Jul-07 2:08
Bekjong10-Jul-07 2:08 
GeneralRe: Generic parameter/reflection problem Pin
Pete O'Hanlon10-Jul-07 2:32
mvePete O'Hanlon10-Jul-07 2:32 
GeneralRe: Generic parameter/reflection problem Pin
Bekjong10-Jul-07 2:41
Bekjong10-Jul-07 2:41 
AnswerRe: Generic parameter/reflection problem Pin
Chintan.Desai10-Jul-07 2:08
Chintan.Desai10-Jul-07 2:08 
GeneralRe: Generic parameter/reflection problem Pin
Bekjong10-Jul-07 2:22
Bekjong10-Jul-07 2:22 
GeneralRe: Generic parameter/reflection problem Pin
Le centriste10-Jul-07 2:38
Le centriste10-Jul-07 2:38 
AnswerRe: Generic parameter/reflection problem Pin
AFSEKI10-Jul-07 6:26
AFSEKI10-Jul-07 6:26 
Dictionary<string, form=""> pool = new Dictionary<string, form="">(10);
pool.Add("myformid", new LoginForm());
pool.Add("myAboutformid", new AboutForm());

public class LoginForm : Form
{
}
public class AboutForm : Form
{
}

Type typLoginForm = typeof(LoginForm);
LoginForm lf = GetForm<typloginform>("myformid");
lf.ShowDialog();

public T GetForm<t>(string form_id) where T: Form
{
return pool[form_id] as T;
}

You can change the Dictionary<string,form> to Dictionary<string, collection<form="">> to add more than 1 item under the same key. Or Dictionary<type, collection<form="">> to get a pool item with its type instead of form_id value which is string.

Fire and Water, Love and Death, Sex and the City? Smile | :)
GeneralRe: Generic parameter/reflection problem Pin
Bekjong10-Jul-07 22:05
Bekjong10-Jul-07 22:05 
AnswerRe: Generic parameter/reflection problem Pin
AFSEKI11-Jul-07 22:04
AFSEKI11-Jul-07 22:04 
GeneralRe: Generic parameter/reflection problem Pin
Bekjong11-Jul-07 22:38
Bekjong11-Jul-07 22:38 
AnswerRe: Generic parameter/reflection problem Pin
AFSEKI11-Jul-07 23:58
AFSEKI11-Jul-07 23:58 
QuestionOPC communication in C# Pin
k reddy10-Jul-07 1:38
k reddy10-Jul-07 1:38 
AnswerRe: OPC communication in C# Pin
AlessandroOPC6-Apr-09 4:59
AlessandroOPC6-Apr-09 4:59 
QuestionShare DB on LAN Pin
mehrdadc4810-Jul-07 1:22
mehrdadc4810-Jul-07 1:22 
AnswerRe: Share DB on LAN Pin
Christian Graus10-Jul-07 1:24
protectorChristian Graus10-Jul-07 1:24 
GeneralRe: Share DB on LAN Pin
mehrdadc4810-Jul-07 1:33
mehrdadc4810-Jul-07 1:33 
GeneralRe: Share DB on LAN Pin
Colin Angus Mackay10-Jul-07 1:44
Colin Angus Mackay10-Jul-07 1:44 
GeneralRe: Share DB on LAN Pin
originSH10-Jul-07 1:48
originSH10-Jul-07 1:48 
QuestionWIN APP ON LAN Pin
Banjo Ayorinde10-Jul-07 0:54
Banjo Ayorinde10-Jul-07 0:54 
AnswerRe: WIN APP ON LAN Pin
Christian Graus10-Jul-07 1:19
protectorChristian Graus10-Jul-07 1:19 
QuestionRemove Duplicates in Datatable Pin
kibromg10-Jul-07 0:52
kibromg10-Jul-07 0:52 
AnswerRe: Remove Duplicates in Datatable Pin
Christian Graus10-Jul-07 1:20
protectorChristian Graus10-Jul-07 1:20 
AnswerRe: Remove Duplicates in Datatable Pin
Chintan.Desai10-Jul-07 2:19
Chintan.Desai10-Jul-07 2:19 
GeneralRe: Remove Duplicates in Datatable Pin
kibromg10-Jul-07 4:53
kibromg10-Jul-07 4:53 

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.