473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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_AssemblyName = "Primary"

Nameclass = "inventory"

Namemethod ="product"

myType = Type.GetType(Application_AssemblyName & "." &
nameclass)

MyObject = CreateInstance(myType)

myMethodInfo = myType.GetMethod(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 1352
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_AssemblyName = "Primary"

Nameclass = "inventory"

Namemethod ="product"

myType = Type.GetType(Application_AssemblyName & "." &
nameclass)

MyObject = CreateInstance(myType)

myMethodInfo = myType.GetMethod(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 _
).AssemblyQualifiedName _
) 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
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,...
1
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 =...
8
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 ...
4
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
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...
4
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...
6
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...
16
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?...
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.