Solved

Type.GetType problem

Posted on 2008-10-29
2
653 Views
Last Modified: 2013-11-07
Hi!

How do I get the type of partial class?

Namespace Test
   Public Partial Class c1
        Public Partial Class c2
              Public Sub Test
              End Sub
        End Class
   End Class
End Namespace

Dim classType as Type = Type.GetType(Test.c1.c2,false,false)

This will return null!
0
Comment
Question by:AWestEng
  • 2
2 Comments
 
LVL 38

Expert Comment

by:PaulHews
Comment Utility
Just use the GetType operator:

Dim classType As Type = GetType(Test.c1.c2)
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
Comment Utility
Type.GetType acts on a string name, but you are passing a class type instead of an string.  You can also use:

Dim classType As Type = Type.GetType("WindowsApplication1.Test.c1+c2", False, False)

Note that WindowsApplication1 is the root namespace.  You would have to change it for your program.  The + precedes a nested class

http://msdn.microsoft.com/en-us/library/a87che9d.aspx
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now