473,804 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gettype problem when invoked from a different project

Hello I have a question. I have a project called "Primary" and in that
project I have a reference to a Com application called "engine". In "engine"
I have a function that does many things and calls other local functions for
several purposes. In one of those functions I have the code:

Dim myType As Type

Application_Ass emblyName = "Primary"

Nameclass = "inventory"

Namemethod ="product"

myType = Type.GetType(Ap plication_Assem blyName & "." &
nameclass)

MyObject = CreateInstance( myType)

myMethodInfo = myType.GetMetho d(namemethod)

The class "inventory" exists in the "Primary" project but it looks like
because this code is in the "engine" project, the Type.GetType returns null.
If I put this code in any function in the "Primary" project it works. How
can I solve this problem? It looks like I have to do something additional.

Thanks in advance

Jennyfer


Nov 21 '05 #1
1 1371
Jennyfer,

"Jennyfer Barco" <pd*****@nospam .wdsinc.com> schrieb:
Hello I have a question. I have a project called "Primary" and in that
project I have a reference to a Com application called "engine". In
"engine" I have a function that does many things and calls other local
functions for several purposes. In one of those functions I have the code:

Dim myType As Type

Application_Ass emblyName = "Primary"

Nameclass = "inventory"

Namemethod ="product"

myType = Type.GetType(Ap plication_Assem blyName & "." &
nameclass)

MyObject = CreateInstance( myType)

myMethodInfo = myType.GetMetho d(namemethod)

The class "inventory" exists in the "Primary" project but it looks like
because this code is in the "engine" project, the Type.GetType returns
null. If I put this code in any function in the "Primary" project it
works. How can I solve this problem? It looks like I have to do something
additional.


You will have to pass the assembly-qualified type name to 'Type.GetType' if
the type is part of another assembly. The snippet below demonstrates how to
determine the assembly-qualified name of a type and creates a 'Type' object
based on the type name:

\\\
MsgBox( _
Type.GetType( _
GetType( _
System.Windows. Forms.Button _
).AssemblyQuali fiedName _
) Is Nothing _
)
///

Prebuilt helper routines which will make finding the assembly-qualified type
name and instantiation easier:

<URL:http://dotnet.mvps.org/dotnet/code/codingtechnique/#ClassByName>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

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

Similar topics

2
3508
by: JohnnySparkles | last post by:
Hi everyone, I'm currently writing an application which uses the XmlSerializer class to serialize/deserialize objects to/from xml. Now when deserializing an XmlDocument back into the object, I'm using the System::Type::GetType(String* typeName) to create a Type* needed to construct the XmlSerializer. The typeName argument is taken from the XmlDocument and consists of the
1
4009
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.
8
46053
by: ron | last post by:
Hi, I am currently using the base class GetType() in the following way and was woundering if there was a different way of looking at types and doing a comparison for equality. Thanks Ron foreach(System.Web.UI.Control ctl in this.Controls) {
4
2675
by: Craig | last post by:
Hi I have a class in the App_Code location of my web project. example: namespace Company.AppName.Objects { public class ObjectA { public ObjectA(){ }
1
1589
by: JQA Academia | last post by:
I've reinstalled twice now... I've got the Visual Studio.net Academic version 2003. During installation, I get no errors but when I try to open a new project from the inital start page, it just hangs and then eventually the application stops responding. I'm running on Windows XP Professional, I've made sure IIS is activated. Any Ideas?
4
1166
by: Mike Walters | last post by:
I have Two Project in one Solution. I am trying to use Type.GetType("string") to pass the "Type" to a Sub. Project one is MWDNav. Project two is MWDBilling. MWDNav is my exe. MWDBing is a Class Library that holds my forms. I am reference MWDBilling and I can create a "new" instance of my MWDBilling.form1 from my MWDNav exe. But then I try to Get the Type of MWDBilling.form1 from my MWDNav I get a myTpye Null error. I am looking for any...
6
1464
by: Paul | last post by:
I have two projects in one solution. One is called Frontier and holds all my base user controls, classes, etc. that are used over multiple applications. The second is my application project (OCFU) which holds the forms and code that the users run. I need to instantiate a new form only given the form's name in a string. In the calling form in the OCFU project I used the following code: Dim objNewForm As Object =...
16
4762
by: danielbuus | last post by:
....or, to put it perhaps more communicative, something like this: Type someObjectsType = someObject.GetType(); someObjectsType newObject = new someObjectsType(); Is this possible? If so, how? Thanks very much in advance, Daniel :)
1
1090
by: Gabriel Genellina | last post by:
En Mon, 05 May 2008 00:31:45 -0300, Barclay, Ken <Ken.Barclay@schwab.comescribió: No entry in the error log, on the web server? (Apache?) Perhaps you're hitting some internal limit of the cgi process, either memory or cpu time per request or temp file size... Are you sure the script runs to completion? Output a message at the end, to be sure. -- Gabriel Genellina
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
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
10588
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
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
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.