|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Type.TypeOf doesn't work ?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 hi lothar
Are you sure you need quotes in your gettype ? -tom lothar.behr***@lollisoft.de ha scritto: Show quoteHide quote > 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 The required parameter is a string. Yes.
Lothar tommaso.gasta***@uniroma1.it wrote: Show quoteHide quote > hi lothar > Are you sure you need quotes in your gettype ? > > -tom > > lothar.behr***@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 My guess would be that the name you are using is not fully qualified. If
this is defined in your application try <PlaceYourAppRootNamespaceHere>.MyInterfaces.IFoo. 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... -- Show quoteHide quotePatrice <lothar.behr***@lollisoft.de> a écrit dans le message de news: 1153473514.682476.129***@m73g2000cwd.googlegroups.com... > The required parameter is a string. Yes. > > Lothar > > tommaso.gasta***@uniroma1.it wrote: >> hi lothar >> Are you sure you need quotes in your gettype ? >> >> -tom >> >> lothar.behr***@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 > 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 <lothar.behr***@lollisoft.de> schreef in bericht Show quoteHide quote news:1153473514.682476.129610@m73g2000cwd.googlegroups.com... > The required parameter is a string. Yes. > > Lothar > > tommaso.gasta***@uniroma1.it wrote: >> hi lothar >> Are you sure you need quotes in your gettype ? >> >> -tom >> >> lothar.behr***@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 > 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: Show quoteHide quote > 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 > > <lothar.behr***@lollisoft.de> schreef in bericht > news:1153473514.682476.129610@m73g2000cwd.googlegroups.com... > > The required parameter is a string. Yes. > > > > Lothar > > > > tommaso.gasta***@uniroma1.it wrote: > >> hi lothar > >> Are you sure you need quotes in your gettype ? > >> > >> -tom > >> > >> lothar.behr***@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 > > I have it, and it works :-)
<wellknown type="Voil.VPMApplicationManager, Voil"> Thanks, Lothar lothar.behr***@lollisoft.de wrote: Show quoteHide quote > 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 > > > > <lothar.behr***@lollisoft.de> schreef in bericht > > news:1153473514.682476.129610@m73g2000cwd.googlegroups.com... > > > The required parameter is a string. Yes. > > > > > > Lothar > > > > > > tommaso.gasta***@uniroma1.it wrote: > > >> hi lothar > > >> Are you sure you need quotes in your gettype ? > > >> > > >> -tom > > >> > > >> lothar.behr***@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 > > >
Can I map the data received from a socket directly to a structure in VB.NET
Return vs Exit Sub Replacing a string inside of a PDF Can't delete VB.NET directories & files... Detecting when VB.net 2005 splash screen closing or closed How to create a sound at specific frequency? VB.net 2005 splash screen and main form problems Disappearing Listbox items... Extra Designer.vb file in Win Form causing problem How do I validate the values entered for custom control properties? |
|||||||||||||||||||||||