473,406 Members | 2,369 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,406 software developers and data experts.

Type.TypeOf doesn't work ?

Hi,

I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")

The following code returns Nothing, but the type above could be
declared for a variable.

Dim appMgr As MyInterfaces.IFoo

Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")

' myType is Nothing !!

Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)

Any ideas ?

Thanks, Lothar

Jul 21 '06 #1
6 1299
hi lothar
Are you sure you need quotes in your gettype ?

-tom

lo************@lollisoft.de ha scritto:
Hi,

I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")

The following code returns Nothing, but the type above could be
declared for a variable.

Dim appMgr As MyInterfaces.IFoo

Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")

' myType is Nothing !!

Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)

Any ideas ?

Thanks, Lothar
Jul 21 '06 #2
The required parameter is a string. Yes.

Lothar

to**************@uniroma1.it wrote:
hi lothar
Are you sure you need quotes in your gettype ?

-tom

lo************@lollisoft.de ha scritto:
Hi,

I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")

The following code returns Nothing, but the type above could be
declared for a variable.

Dim appMgr As MyInterfaces.IFoo

Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")

' myType is Nothing !!

Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)

Any ideas ?

Thanks, Lothar
Jul 21 '06 #3
My guess would be that the name you are using is not fully qualified. If
this is defined in your application try
<PlaceYourAppRootNamespaceHere>.MyInterfaces.IFo o. If another DLL and you
imported the names, still use the full qualified name. If in doubt about the
fully qualified name, use the object browser to see the full qualified
name...

--
Patrice

<lo************@lollisoft.dea écrit dans le message de news:
11**********************@m73g2000cwd.googlegroups. com...
The required parameter is a string. Yes.

Lothar

to**************@uniroma1.it wrote:
>hi lothar
Are you sure you need quotes in your gettype ?

-tom

lo************@lollisoft.de ha scritto:
Hi,

I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")

The following code returns Nothing, but the type above could be
declared for a variable.

Dim appMgr As MyInterfaces.IFoo

Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")

' myType is Nothing !!

Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)

Any ideas ?

Thanks, Lothar

Jul 21 '06 #4
Lothar,

I don't believe it is the problem, but the information on MSDN on Gettype
for VBNet is lousy.

In VBNet it is normally easier to use Gettype(System.String)

Just as addition to Patrice,

Cor

<lo************@lollisoft.deschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
The required parameter is a string. Yes.

Lothar

to**************@uniroma1.it wrote:
>hi lothar
Are you sure you need quotes in your gettype ?

-tom

lo************@lollisoft.de ha scritto:
Hi,

I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")

The following code returns Nothing, but the type above could be
declared for a variable.

Dim appMgr As MyInterfaces.IFoo

Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")

' myType is Nothing !!

Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)

Any ideas ?

Thanks, Lothar

Jul 21 '06 #5
Yes,

after reading about GetType, I have changed it to
GetType(Assembly.ClassTypeName).

This works for now, but I am in trouble with FileNotFoundException on
server side.
Maybe my app.config for the remoting configuration is not correct:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<!-- Some chanels -->
</channels>
<service>
<wellknown type="Voil.VPMApplicationManager, VPMApplicationManager"
objectUri="VPMApplicationManager.rem" mode="Singleton" />
</service>
<RemoteServer>localhost</RemoteServer>
</application>
</system.runtime.remoting>

</configuration>

I'll do research on it, too :-)

Lothar

Cor Ligthert [MVP] wrote:
Lothar,

I don't believe it is the problem, but the information on MSDN on Gettype
for VBNet is lousy.

In VBNet it is normally easier to use Gettype(System.String)

Just as addition to Patrice,

Cor

<lo************@lollisoft.deschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
The required parameter is a string. Yes.

Lothar

to**************@uniroma1.it wrote:
hi lothar
Are you sure you need quotes in your gettype ?

-tom

lo************@lollisoft.de ha scritto:

Hi,

I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")

The following code returns Nothing, but the type above could be
declared for a variable.

Dim appMgr As MyInterfaces.IFoo

Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")

' myType is Nothing !!

Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)

Any ideas ?

Thanks, Lothar
Jul 21 '06 #6
I have it, and it works :-)

<wellknown type="Voil.VPMApplicationManager, Voil">

Thanks, Lothar

lo************@lollisoft.de wrote:
Yes,

after reading about GetType, I have changed it to
GetType(Assembly.ClassTypeName).

This works for now, but I am in trouble with FileNotFoundException on
server side.
Maybe my app.config for the remoting configuration is not correct:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<!-- Some chanels -->
</channels>
<service>
<wellknown type="Voil.VPMApplicationManager, VPMApplicationManager"
objectUri="VPMApplicationManager.rem" mode="Singleton" />
</service>
<RemoteServer>localhost</RemoteServer>
</application>
</system.runtime.remoting>

</configuration>

I'll do research on it, too :-)

Lothar

Cor Ligthert [MVP] wrote:
Lothar,

I don't believe it is the problem, but the information on MSDN on Gettype
for VBNet is lousy.

In VBNet it is normally easier to use Gettype(System.String)

Just as addition to Patrice,

Cor

<lo************@lollisoft.deschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
The required parameter is a string. Yes.
>
Lothar
>
to**************@uniroma1.it wrote:
>hi lothar
>Are you sure you need quotes in your gettype ?
>>
>-tom
>>
>lo************@lollisoft.de ha scritto:
>>
Hi,
>
I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")
>
The following code returns Nothing, but the type above could be
declared for a variable.
>
Dim appMgr As MyInterfaces.IFoo
>
Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")
>
' myType is Nothing !!
>
Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)
>
Any ideas ?
>
Thanks, Lothar
>
Jul 21 '06 #7

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

Similar topics

3
by: James Marshall | last post by:
I need to detect the type of an object, more than just "object" as typeof gives us. I'm writing a general handler that accepts a variety of objects and properties, and acts accordingly depending...
5
by: jorfei | last post by:
I have written a component with a property IPAdrress of type System.Net.IPAddress. To ease the configuration of the component at design time, I have written a type converter for the type...
7
by: Bennett Haselton | last post by:
Is there any way to find a string representing an object's class, which will work in Internet Explorer 6? "typeof" doesn't work -- it returns "object" for all objects: x =...
26
by: Michael McGarry | last post by:
Hi, I am pretty sure this is not possible, but maybe somehow it is. Given a variable, can I tell what type it is at runtime? Michael
2
by: Tom Hundley | last post by:
Scenario: - I'm dumping an int value of myEnum into a table. - I am getting that int value out of the table. - I need to set myEnum equal to that int value Easy enough: private enum animals...
11
by: JohnR | last post by:
I'm trying to find a way to create a variable of a given type at runtime where I won't know the type until it actually executes. For example, dim x as object = "hi" x is declared as an object...
3
by: john | last post by:
Hi to All To demonstrate: public class MyBaseGenericClass<T> { } public class MyGenericClass1<T: MyBaseGenericClass<T> {
7
by: Paul Hadfield | last post by:
Hi, I'm running into one problem with trying to call "Type.GetCustomAttributes(...)" on my reflected code. Basically - I can't trap my own custom attribute - I can only catch / identify system...
4
by: Random | last post by:
I want to define a generics method so the user can determine what type they expect returned from the method. By examining the generics argument, I would determine the operation that needs to be...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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,...

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.