Click here to Skip to main content
15,900,511 members
Home / Discussions / C#
   

C#

 
GeneralRe: search dialog Pin
Luc Pattyn10-Jul-07 4:20
sitebuilderLuc Pattyn10-Jul-07 4:20 
AnswerRe: search dialog Pin
mav.northwind10-Jul-07 3:40
mav.northwind10-Jul-07 3:40 
QuestionHow to show a bookmarked position in default browser? Pin
mav.northwind10-Jul-07 2:18
mav.northwind10-Jul-07 2:18 
AnswerRe: How to show a bookmarked position in default browser? Pin
Luc Pattyn10-Jul-07 2:46
sitebuilderLuc Pattyn10-Jul-07 2:46 
GeneralRe: How to show a bookmarked position in default browser? Pin
mav.northwind10-Jul-07 3:34
mav.northwind10-Jul-07 3:34 
GeneralRe: How to show a bookmarked position in default browser? Pin
Luc Pattyn10-Jul-07 4:00
sitebuilderLuc Pattyn10-Jul-07 4:00 
GeneralRe: How to show a bookmarked position in default browser? Pin
mav.northwind10-Jul-07 4:24
mav.northwind10-Jul-07 4:24 
QuestionGeneric parameter/reflection problem Pin
Bekjong10-Jul-07 1:46
Bekjong10-Jul-07 1:46 
Hi,

I've created the following function (it gets forms from a pool):

public formType GetForm<formType>(string form_id) where formType : Form

I've stored the type of form I want to get in a Type variable somewhere, for example:

Type classToGet = typeof(Form);

The Form is just an example, this normally determined dynamically.

Now when I try to call my GetForm function like this:

GetForm<classToGet>("myformid");

I get a compiler exception saying "classToGet is a type parameter but is used like variable" and that "Type or namespace classToGet could not be found".

Is there anyway of solving this problem? I suppose there's a problem involving me not understanding reflection thoroughly enough. I realize I'm passing an argument of type Type but I can't seem te get my mind around converting the Type class to the class-reference I need here.

Thanks in advance for any help!



Standards are great! Everybody should have one!

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 
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 

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.