hi Thanks for the code. The problem is I am using system.ComponentModel.component the reference type is nothing .. how will i get the assembly name for this..
my requirement is like this if the user says imports Microsoft.Biztalk.btsconfig I have to find the assembly name from the microsoft.biztalk.btsconfig and i should add the assembly name to the .net script engine What will i do if the reference type is nothing regards gan --- Mitch Denny <[EMAIL PROTECTED]> wrote: > Hi all/George, > > Below is the code that I would have converted my C# > sample into, > however George is quite correct, it doesn't seem to > be working > at all. When executed, if it all works it should > return a message > box giving the full assembly name for System.dll but > it doesn't. > > Probably best to read the code now so you know what > I am jabbering > on about: > > Imports FindAsmVB > Imports System > Imports System.ComponentModel > Imports System.Reflection > Imports System.Windows > Imports System.Windows.Forms > > Namespace FindAsmVB > > Public Class EntryPoint > > Public Shared Sub Main() > > ' Declare locals. > Dim typeToFind As String > Dim typeReference As Type > > ' Try and find type. > typeToFind = > "System.ComponentModel.Component" > typeReference = Type.GetType(typeToFind, > False, True) > If (typeReference Is Nothing) Then > > MessageBox.Show( _ > String.Format( _ > "Could not find type: {0} in > loaded > assemblies.", _ > typeToFind _ > ) _ > ) > > Else > > MessageBox.Show( _ > String.Format( _ > "Found type: {0} in > assembly: {1}.", _ > typeReference.FullName, _ > > typeReference.Assembly.FullName _ > ) _ > ) > > > Trace.WriteLine(typeReference.Assembly.FullName) > > End If > > End Sub > > End Class > > End Namespace > > I thought that perhaps the System.dll assembly > wasn't > getting loaded because I don't really need it, so I > inserted this diagnostic code up the top: > > Trace.Indent() > > Dim assm As System.Reflection.Assembly > For Each assm In > AppDomain.CurrentDomain.GetAssemblies() > > > Trace.WriteLine(String.Format("Assembly: {0}", > assm.FullName)) > > Trace.Indent() > > Dim modu As System.Reflection.Module > For Each modu in assm.GetModules() > > > Trace.WriteLine(String.Format("Module: {0}", > modu.Name)) > > Next > > Trace.Unindent() > > Next > > Trace.Unindent() > > The output clearly shows that the System.dll > assembly > is being loaded: > > Assembly: mscorlib, Version=1.0.3300.0, > Culture=neutral, > PublicKeyToken=b77a5c561934e089 > Module: mscorlib.dll > Assembly: FindAsmVB, Version=1.0.900.29656, > Culture=neutral, > PublicKeyToken=null > Module: FindAsmVB.exe > Assembly: System, Version=1.0.3300.0, > Culture=neutral, > PublicKeyToken=b77a5c561934e089 > Module: system.dll > Assembly: System.Windows.Forms, > Version=1.0.3300.0, Culture=neutral, > PublicKeyToken=b77a5c561934e089 > Module: system.windows.forms.dll > Assembly: System.Xml, Version=1.0.3300.0, > Culture=neutral, > PublicKeyToken=b77a5c561934e089 > Module: system.xml.dll > > In fact, you look at the debug output in VS.NET or > using > cordbg.exe you can see it there anyway without my > trace > code. Basically I want to understand what I am doing > wrong > here, perhaps some of the CLR gurus can help me out. > > I'll give this question a shot here, and if that > fails I > will try posting on the DOTNET-CLR list to see how I > go. > > ---------------------------------------- > - Mitch Denny > - [EMAIL PROTECTED] > - +61 (414) 610-141 > - > > -----Original Message----- > From: The DOTNET list will be retired 7/1/02 > [mailto:[EMAIL PROTECTED]] On Behalf Of > george antony > Sent: Wednesday, 19 June 2002 14:34 > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] Urgent pls -finding the > assembly name from > namespace > > > hi this is my code > > > Dim mytype As Type > mytype = > Type.GetType("System.ComponentModel.Component") > MsgBox(mytype) > > i am getting nothing in the msgbox > pls help on this. its very urgent for me now > > regards > gan > --- Paul Gaske <[EMAIL PROTECTED]> wrote: > > That's a good start, but what about: > > > > >dim mytype as type= > > >type.gettype("System.Componentmodel.Component") > > > > Should be: > > > > Dim mytype as type = > > type.gettype("System.ComponentModel.Component") > > > > Note the capital 'M' for 'Model'. > > > > Cheers, > > Paul. > > > > -----Original Message----- > > From: Nicolas Benech > > [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, 19 June 2002 2:15 PM > > To: [EMAIL PROTECTED] > > Subject: Re: Urgent pls -finding the assembly name > > from namespace > > > > > > Chris meant that you have some typo in your code > > sample: > > > > > > dim x as system.refelction.assembly > > > > > x=system.refelction.assembly.getassembly(mytype) > === message truncated === __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.