can't reference .NET assembly's classes in VB 
Author Message
 can't reference .NET assembly's classes in VB

Hi Folks,

I create .NET Framework assembly which consists of multiple java files.
I can register my assembly MyAssembly.dll in GAC with no problems.
When I use ILDASM tool all classes are showing up, for example: Class1,
Class2, Class3.
In my VB project I set reference to MyAssembly.dll.

Here the problem starts: when I declare Dim myObj As MyAssembly.Class2 it
shows the list with all the classes available to me.
But when I do Set myObj = New MyAssembly.Class2 inside of Sub it doesn't see
Class2 any more and shows only one Class1 available.
By some reason Class1 is set as default one.
How can I avoid this? What wrong am I doing? Did anybody have a similar
problem?

Thanks in advance,

Lena

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.*-*-*.com/ ).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/03



Sun, 11 Sep 2005 09:28:49 GMT  
 can't reference .NET assembly's classes in VB
I'm guessing by the syntax "Set myObj = New MyAssembly.Class2 " that you are
in VB6.  COM understands classes completely different than .NET.  I'm
assuming that you used regasm.exe to regeister the assembly for use with COM
and that you also created a type library for the intellisense in your VB6
project.  If all of that was done then it's possible that you didn't create
an Interface.  It's a general rule Declaring and Implementing an Interface
in your .NET assembly will help COM understand it better.  Something like:

.NET Assembly

Public Interface ISomething
    Public Sub DoSomething
End Interface

Public Class1
    Implements ISomething

    Public Sub DoSomething Implements ISomething.DoSomething

    End Sub
End Class

VB6 Project

Dim objTemp as ISomething

Set objTemp = new Class1

Hope this helps.

--

Dean


Quote:
> Hi Folks,

> I create .NET Framework assembly which consists of multiple java files.
> I can register my assembly MyAssembly.dll in GAC with no problems.
> When I use ILDASM tool all classes are showing up, for example: Class1,
> Class2, Class3.
> In my VB project I set reference to MyAssembly.dll.

> Here the problem starts: when I declare Dim myObj As MyAssembly.Class2 it
> shows the list with all the classes available to me.
> But when I do Set myObj = New MyAssembly.Class2 inside of Sub it doesn't
see
> Class2 any more and shows only one Class1 available.
> By some reason Class1 is set as default one.
> How can I avoid this? What wrong am I doing? Did anybody have a similar
> problem?

> Thanks in advance,

> Lena

> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/03



Mon, 12 Sep 2005 02:40:12 GMT  
 can't reference .NET assembly's classes in VB
Hi Dean,

thank you very much for your reply.
Sorry, if I was a little unclear in my explanations, although you understood
my problem very right. I had a thought about the interface, but I wasn't
sure if it's the case.

I'm still a bit unclear about writting the interface. What does the ".NET
Assembly" line mean? Can the interface be written in Java as all the rest of
my assembly or it has to be VB6?

Thanks,

Lena


Quote:
> I'm guessing by the syntax "Set myObj = New MyAssembly.Class2 " that you
are
> in VB6.  COM understands classes completely different than .NET.  I'm
> assuming that you used regasm.exe to regeister the assembly for use with
COM
> and that you also created a type library for the intellisense in your VB6
> project.  If all of that was done then it's possible that you didn't
create
> an Interface.  It's a general rule Declaring and Implementing an Interface
> in your .NET assembly will help COM understand it better.  Something like:

> .NET Assembly

> Public Interface ISomething
>     Public Sub DoSomething
> End Interface

> Public Class1
>     Implements ISomething

>     Public Sub DoSomething Implements ISomething.DoSomething

>     End Sub
> End Class

> VB6 Project

> Dim objTemp as ISomething

> Set objTemp = new Class1

> Hope this helps.

> --

> Dean



> > Hi Folks,

> > I create .NET Framework assembly which consists of multiple java files.
> > I can register my assembly MyAssembly.dll in GAC with no problems.
> > When I use ILDASM tool all classes are showing up, for example: Class1,
> > Class2, Class3.
> > In my VB project I set reference to MyAssembly.dll.

> > Here the problem starts: when I declare Dim myObj As MyAssembly.Class2
it
> > shows the list with all the classes available to me.
> > But when I do Set myObj = New MyAssembly.Class2 inside of Sub it doesn't
> see
> > Class2 any more and shows only one Class1 available.
> > By some reason Class1 is set as default one.
> > How can I avoid this? What wrong am I doing? Did anybody have a similar
> > problem?

> > Thanks in advance,

> > Lena

> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/03

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 25/03/03


Mon, 12 Sep 2005 06:31:20 GMT  
 can't reference .NET assembly's classes in VB
The ".NET Assembly" line was merely my attempt at describing the location of
the following code.  It has no syntax value.

I would assume that you could write the interface in Java, although since I
don't use Java I couldn't tell you how.   You might try the Java.net
newsgroups.  I'm sure it is fairly common.

--

Dean


Quote:
> Hi Dean,

> thank you very much for your reply.
> Sorry, if I was a little unclear in my explanations, although you
understood
> my problem very right. I had a thought about the interface, but I wasn't
> sure if it's the case.

> I'm still a bit unclear about writting the interface. What does the ".NET
> Assembly" line mean? Can the interface be written in Java as all the rest
of
> my assembly or it has to be VB6?

> Thanks,

> Lena



> > I'm guessing by the syntax "Set myObj = New MyAssembly.Class2 " that you
> are
> > in VB6.  COM understands classes completely different than .NET.  I'm
> > assuming that you used regasm.exe to regeister the assembly for use with
> COM
> > and that you also created a type library for the intellisense in your
VB6
> > project.  If all of that was done then it's possible that you didn't
> create
> > an Interface.  It's a general rule Declaring and Implementing an
Interface
> > in your .NET assembly will help COM understand it better.  Something
like:

> > .NET Assembly

> > Public Interface ISomething
> >     Public Sub DoSomething
> > End Interface

> > Public Class1
> >     Implements ISomething

> >     Public Sub DoSomething Implements ISomething.DoSomething

> >     End Sub
> > End Class

> > VB6 Project

> > Dim objTemp as ISomething

> > Set objTemp = new Class1

> > Hope this helps.

> > --

> > Dean



> > > Hi Folks,

> > > I create .NET Framework assembly which consists of multiple java
files.
> > > I can register my assembly MyAssembly.dll in GAC with no problems.
> > > When I use ILDASM tool all classes are showing up, for example:
Class1,
> > > Class2, Class3.
> > > In my VB project I set reference to MyAssembly.dll.

> > > Here the problem starts: when I declare Dim myObj As MyAssembly.Class2
> it
> > > shows the list with all the classes available to me.
> > > But when I do Set myObj = New MyAssembly.Class2 inside of Sub it
doesn't
> > see
> > > Class2 any more and shows only one Class1 available.
> > > By some reason Class1 is set as default one.
> > > How can I avoid this? What wrong am I doing? Did anybody have a
similar
> > > problem?

> > > Thanks in advance,

> > > Lena

> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/03

> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.465 / Virus Database: 263 - Release Date: 25/03/03



Tue, 13 Sep 2005 00:08:07 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 'Canned' data in VB program

2. Can't add class to ASP.NET project - Automation server can't create object

3. Can't Add Web Reference when using vb.net

4. 'net use \\servername' in VB.NET

5. question about using vb.net's Web.Mail class

6. VB.NET DLL's With A VB.NET App

7. referencing a control's 'parent'

8. VB.net 'Ceil'-Function?

9. vb.net SITE's Any really good ONE's TIA

10. VB.NET - C#.NEt Cross assembly calling?

11. My Vb.Net Apps will not run on other machine's with .Net Framework installed

12. Excel'perts:Problem:delet'g #REF range references

 

 
Powered by phpBB® Forum Software