GetType

1 view
Skip to first unread message

mr t

unread,
Feb 5, 2009, 4:00:04 AM2/5/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I do like this inside my aspx page

Type.GetType("System.Web.UI.TemplateControl", True, True)

it throws an error or I get null. It can't find TemplateControl.

what is the best way to get that type, because I know it is there...

thanks.

Cerebrus

unread,
Feb 5, 2009, 11:48:29 AM2/5/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
See this very recent thread:

http://groups.google.co.in/group/DotNetDevelopment/browse_thread/thread/af8719c9d17854cf/

To elaborate a bit, there are atleast 3 ways to evaluate type in VB :

---
'The "GetType" operator is a great convenience for VB users.
Dim t1 As Type = GetType(System.Web.UI.TemplateControl)

'When you know the Assembly Qualified name.
Dim t2 As Type = Type.GetType("System.Web.UI.TemplateControl,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a")

' When you have an object variable.
' I use Label in this example, not TemplateControl, because the latter
has no constructor.
Dim myLabel As New Label()
Dim t3 As Type = myLabel.GetType()
---
Reply all
Reply to author
Forward
0 new messages