473,725 Members | 2,238 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Type.GetType in an already loaded assembly

TN
I have an application that is using System.Windows. Forms. I'd like to
use Type.GetType() to get a Type so I can create an instance of it using
reflection. The only way I can get it to return the type is:

Type tt = Type.GetType(
"System.Windows .Forms.TextBox, System.Windows. Forms, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9");

Since (I assume) when my application is running System.Windows. Forms
assembly is already loaded, there must be a way to get the type from the
loaded assembly, instead of having to specify version/culture/token
information.
Can anyone shed some light on this dim bulb?
Thanks.
Jan 26 '06 #1
1 1857
1. obtain assembly reference for example from
AppDomain.GetAs semblies
2. search type in well-defined assembly
Assembly.GetTyp e

Jan 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1731
by: MarkB | last post by:
I am new to using reflection, and I can't understand why this code fails for sClass="CheckBox" 'get loaded assemblies oAssemblies = AppDomain.CurrentDomain.GetAssemblies() 'find our type in one of the assemblies For Each oAssembly In oAssemblies oType = oAssembly.GetType(sClass, False, True)
1
4004
by: Jean Stax | last post by:
Hi ! I created a sample library project. In my second project I reference this library and make the following call, which returns "undefined value": Type myType = Type.GetType("SampleLib.MyClass"); My guess was that the function fails because my library isn't loaded yet.
1
1717
by: Sacha | last post by:
If I use Assembly.LoadFile("name.dll") and then I want to create instace of class inside the assembly using reflection Type.GetType("class.name") doesn't work unless I do Assembly asm = Assembly.LoadFile("name.dll"); Type t = asm.GetType("class.name"); Is there a way to expose the new Assembly globally dynamically so I can use the standard Type.GetType()? I don't want to keep track of which assembly I loaded and where each class is...
2
3196
by: Jax | last post by:
I'm having difficulty with creating dynamic types, TypeBuilder is attained through module builder which in turn comes from assembly builder. I assumed that if you save the assembly you'd save the type (made with the typebuilder) as well. When I save and load the assembly it comes back as having no types Is there a certain set of rules the type or assembly must comply to for it to be valid If so, what might those rules be I greatly...
1
3219
by: hazz | last post by:
"Value cannot be null.\r\nParameter name: type" is the exception thrown after the CreateInstance method below. Type t = Type.GetType(GetConfigValue("PasswordProvider")); IPasswordProvider ppdr= (IPasswordProvider)Activator.CreateInstance(t); GetConfigValue DOES return the correct value from the config file - "namespace.DBPassword, namespace" It appears that Type.GetType is NOT finding the assembly whose name is the
4
5105
by: Max | last post by:
Hi, I would like to have a button and a combo box with options to select various versions of Microsoft Outlook: 2002, 2003. The user selects the email client and clicks the button. The only things happening will be: a new email is created and some text is placed in the body, then the email window is displayed. The user can close the window or select some recipients and send the message. I would like some info on how to do this correctly....
16
6526
by: Andrew Ducker | last post by:
Is there any way to use Type.GetType to return a type that's in an Assembly loaded from disk? I sadly _have_ to use Type.GetType, as it's in framework code I can't change. At the moment, I'm loading the Assembly from disk (which works fine) and adding it to the current AppDomain (just to be on the safe side), but even when I do that, Type.GetType fails to find it.
1
2782
by: lit | last post by:
I want to use Type.GetType(typeName) for a class defined in an assembly that will be in the GAC. I understand that I must provide strong name information such as the KeyPair or versioninfo in the typeName string. The Type that I am getting is statically referenced by other classes of other assemblies that will be loaded into the appdomain. Therefore, the strong name info should be dynamically available to me. I want to be able to...
4
2250
by: Dan Manges | last post by:
Given a type as a string, is there an easy way using reflection to find where it resides in the .NET framework? Example: Given "XmlNode", get "System.Xml" Given "ArrayList", get "System.Collections" Given "DataSet", get "System.Data" Thanks in advance,
0
8749
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9398
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8080
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4507
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4777
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2153
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.