Thanks for the help Dean. All the objects I'm trying to instancies all 
implement a standard interface.
 
Unfortunately, I can't seem to instantiate the object successully. The 
CreateInstance method runs without error, but the CurrentObject remains 
uninstantiated and null. I get a 
 
Here's my exact code from the ASPX page: 
 
'get data row
Dim CurrentRowID as Integer = 1                        ' Test value for Row ID
Dim NodeObjectName as String = "LinkNode"     ' Text value for object type name
 
'Instantiate Node object and render
Dim a as [Assembly] = [Assembly].GetExecutingAssembly()
Dim CurrentObject      
CurrentObject = a.CreateInstance(NodeObjectName)
response.write(CurrentObject.Render(CurrentRowID))
 
 
I think my problem is that I don't understand what Dim a as [Assembly] = 
[Assembly].GetExecutingAssembly() actually does. 
 
Am I supposed to leave the brackets in there? 
 
Here's some info that might help: 
My assembly's name is called Ninocentral. It resides in the bin directory (not 
the GAC) and its namespace is imported into the current page.
The object I'm trying to instantiate is in the following namespace: 
Ninocentral.Apps.Infomanager
 
Thanks again,
 
M.
 
 
 
 
 


________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf 
Of Dean Fiala
Sent: Thursday, October 27, 2005 1:05 PM
To: [email protected]
Subject: Re: [AspNetAnyQuestionIsOk] OOP Help?


Assuming all the objects inherit from a common base class or implement
the same interface, you could do something like this...

Dim a as Assembly = [Assembly].GetExecutingAssembly()
Dim CurrentObject as iRow

For Each iRow in dtObjects.rows
   CurrentObject  = a.CreateInstance(ObjectType)
   CurrentObject.Render()
Next

On 10/27/05, Matías Niño ListMail <[EMAIL PROTECTED]> wrote:
> This question if for anyone with a good understanding of how OOP works in 
> .NET.
>
> I have an ASP.NET web page with a bunch of rows in a Datatable.
>
> Each row contains a string column (ObjectType) which represents one of many 
> class types.
>
> I need .NET to be able to instantiate the object specified by that string 
> column and call a common RENDER() method that all the objects will have.
>
> What I'm trying to avoid doing is coding a giant select statement that 
> translates the objecttype string and instantiates the right object. I'd 
> Imagine .NET can somehow do that. Am I right?
>
> Here's pseudocode of what I'm imagining must be possible:
>
> For Each iRow in dtObjects.rows
>     Dim CurrentObject as New iRow("ObjectType")
>     CurrentObject.Render()
> Next
>
> Thanks in advance for any pointers.
>
> M.
> Manassas, VA
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com



SPONSORED LINKS 
Basic programming language 
<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbVU-A>
         Computer programming languages 
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ>
         Programming languages 
<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
   
Java programming language 
<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB1g>
   

________________________________

YAHOO! GROUPS LINKS 


        
*        Visit your group "AspNetAnyQuestionIsOk 
<http://groups.yahoo.com/group/AspNetAnyQuestionIsOk> " on the web.
          
*        To unsubscribe from this group, send an email to:
         [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
          
*        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service 
<http://docs.yahoo.com/info/terms/> . 


________________________________




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to