473,399 Members | 3,603 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,399 software developers and data experts.

Class Library

Good afternoon.

I would like to know if is possible use a dll made in Vb.net in VB 6.

I made this to test the dll:

Imports System.Data

Imports System.Xml

Public Class RH

Public Shared Function addHistory(ByVal txtFind As String, ByVal txtReplace
As String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

the code is rigth, when I try to register with the command "regsvr32" happen
a error:
"---------------------------
RegSvr32
---------------------------
ReplaceHistory.dll was loaded, but the DllRegisterServer entry point was not
found.

DllRegisterServer may not be exported, or a corrupt version of
ReplaceHistory.dll may be in memory. Consider using PView to detect and
remove it.
"
What I need to make to use the dll in VB 6?

Luis Gustavo - Brazil

msn: lu*********@cions.com.br


Nov 20 '05 #1
8 1796
Add this Code
<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> _
Public Class Class1
#Region "COM Class IDs"
Public Const ClassID As String = "5F0D4112-B23D-4703-94F5-B5B96E50F3BB"
Public Const InterfaceId As String =
"A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"
Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF"
#End Region
Sub Main()
End Sub
End Class

This makes your DLL emulate an ActiveX control. From here, you can register
it, or select the option in the project properties to register it for COM
interop. One thing to remember about the ID's, you need to use the utility
"Luis Gustavo" <lg****@nsb.com.br> wrote in message guidgen, and select
Registry Format. Otherwise, should work just fine.

Good Luck and HTH
Tibby

news:e9**************@TK2MSFTNGP09.phx.gbl...
Good afternoon.

I would like to know if is possible use a dll made in Vb.net in VB 6.

I made this to test the dll:

Imports System.Data

Imports System.Xml

Public Class RH

Public Shared Function addHistory(ByVal txtFind As String, ByVal txtReplace As String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

the code is rigth, when I try to register with the command "regsvr32" happen a error:
"---------------------------
RegSvr32
---------------------------
ReplaceHistory.dll was loaded, but the DllRegisterServer entry point was not found.

DllRegisterServer may not be exported, or a corrupt version of
ReplaceHistory.dll may be in memory. Consider using PView to detect and
remove it.
"
What I need to make to use the dll in VB 6?

Luis Gustavo - Brazil

msn: lu*********@cions.com.br

Nov 20 '05 #2
"Luis Gustavo" <lg****@nsb.com.br> schrieb
Good afternoon.

I would like to know if is possible use a dll made in Vb.net in VB
6.

I made this to test the dll:

Imports System.Data

Imports System.Xml

Public Class RH

Public Shared Function addHistory(ByVal txtFind As String, ByVal
txtReplace As String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

the code is rigth, when I try to register with the command "regsvr32"
happen a error:
"---------------------------
RegSvr32
---------------------------
ReplaceHistory.dll was loaded, but the DllRegisterServer entry point
was not found.

DllRegisterServer may not be exported, or a corrupt version of
ReplaceHistory.dll may be in memory. Consider using PView to detect
and remove it.
"
What I need to make to use the dll in VB 6?

You probably already know that VB6 can create and use COM/ActiveX DLLs or
use "standard" DLLs. As VB.Net creates managed assemblies they are based on
(completely) different techniques. However, you can also create COM Interop
wrappersin VB.Net. An entry point is here:

http://msdn.microsoft.com/library/en...sicVisualC.asp

http://msdn.microsoft.com/library/en...nentstocom.asp

http://msdn.microsoft.com/library/en...alBasicNET.asp
You'll also find these (and from there other topics) in the <F1> docs.

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
I need to make one minor correction, in this portion:
<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> ;
Rythmia is the name of my class, so it should read Class1 in this example.

"Tibby" <ti*************@hotmail.com> wrote in message
news:#3**************@TK2MSFTNGP09.phx.gbl...
Add this Code
<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> _
Public Class Class1
#Region "COM Class IDs"
Public Const ClassID As String = "5F0D4112-B23D-4703-94F5-B5B96E50F3BB"
Public Const InterfaceId As String =
"A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"
Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF"
#End Region
Sub Main()
End Sub
End Class

This makes your DLL emulate an ActiveX control. From here, you can register it, or select the option in the project properties to register it for COM
interop. One thing to remember about the ID's, you need to use the utility "Luis Gustavo" <lg****@nsb.com.br> wrote in message guidgen, and select
Registry Format. Otherwise, should work just fine.

Good Luck and HTH
Tibby

news:e9**************@TK2MSFTNGP09.phx.gbl...
Good afternoon.

I would like to know if is possible use a dll made in Vb.net in VB 6.

I made this to test the dll:

Imports System.Data

Imports System.Xml

Public Class RH

Public Shared Function addHistory(ByVal txtFind As String, ByVal

txtReplace
As String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

the code is rigth, when I try to register with the command "regsvr32"

happen
a error:
"---------------------------
RegSvr32
---------------------------
ReplaceHistory.dll was loaded, but the DllRegisterServer entry point was

not
found.

DllRegisterServer may not be exported, or a corrupt version of
ReplaceHistory.dll may be in memory. Consider using PView to detect and
remove it.
"
What I need to make to use the dll in VB 6?

Luis Gustavo - Brazil

msn: lu*********@cions.com.br


Nov 20 '05 #4
Not to forget type library guid:

<Assembly: Guid("6489269F-2E92-448B-96AF-A9C70B7C8E71")> in file
AssemblyInfo.vb

Your class must always have a public parameterless constructor. Constructors
with parameters or shared properties/methods/fields are not accessible.

You may use Regasm.exe to create type libarary, reg file or install your
assembly on client machines. But be careful what you expose to Non.NET
world!

Cheers
Ali
"Luis Gustavo" <lg****@nsb.com.br> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
Good afternoon.

I would like to know if is possible use a dll made in Vb.net in VB 6.

I made this to test the dll:

Imports System.Data

Imports System.Xml

Public Class RH

Public Shared Function addHistory(ByVal txtFind As String, ByVal txtReplace As String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

the code is rigth, when I try to register with the command "regsvr32" happen a error:
"---------------------------
RegSvr32
---------------------------
ReplaceHistory.dll was loaded, but the DllRegisterServer entry point was not found.

DllRegisterServer may not be exported, or a corrupt version of
ReplaceHistory.dll may be in memory. Consider using PView to detect and
remove it.
"
What I need to make to use the dll in VB 6?

Luis Gustavo - Brazil

msn: lu*********@cions.com.br

Nov 20 '05 #5
First, thank for your helps !!!
What I'm doing wrong ?

the code:

class1.vb:
===================================
Imports System.Data

Imports System.Xml

<ComClass(RH.ClassID, RH.InterfaceId, RH.EventsId)> _

Public Class RH

#Region "COM Class IDs"

Public Const ClassID As String = "5F0D4112-B23D-4703-94F5-B5B96E50F3BB"

Public Const InterfaceId As String = "A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"

Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF"

#End Region

Public val As Integer

Public Sub New()

val = 0

End Sub

Public Function addHistory(ByVal txtFind As String, ByVal txtReplace As
String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

===================================
AssemblyInfo.vb:
===================================
Imports System

Imports System.Reflection

Imports System.Runtime.InteropServices

<Assembly: AssemblyTitle("")>

<Assembly: AssemblyDescription("")>

<Assembly: AssemblyCompany("")>

<Assembly: AssemblyProduct("")>

<Assembly: AssemblyCopyright("")>

<Assembly: AssemblyTrademark("")>

<Assembly: CLSCompliant(True)>

'<Assembly: Guid("E8C42458-4ED8-4485-8145-A364D099BC5B")>

<Assembly: Guid("6489269F-2E92-448B-96AF-A9C70B7C8E71")>

<Assembly: AssemblyVersion("1.0.*")>

===================================

I build the solution and is OK !!!

then I open the prompt and execute the command "regasm.exe" so "regasm
replacehistory.dll" and display the message:
"Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Types registered successfully"

I try too: "regasm ReplaceHistory.dll /regfile:rh.reg" and display the
message:
"
Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.57
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Registry script 'C:\Documents and Settings\gustavo\My Documents\VBdotN
ace\ReplaceHistory\ReplaceHistory\bin\rh.reg' generated successfully
"
and open the reg file.

when I try to execute "regsvr32", the same message is display.

"Tibby" <ti*************@hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP11.phx.gbl...
I need to make one minor correction, in this portion:
<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> ;
Rythmia is the name of my class, so it should read Class1 in this example.

"Tibby" <ti*************@hotmail.com> wrote in message
news:#3**************@TK2MSFTNGP09.phx.gbl...
Add this Code
<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> _
Public Class Class1
#Region "COM Class IDs"
Public Const ClassID As String = "5F0D4112-B23D-4703-94F5-B5B96E50F3BB" Public Const InterfaceId As String =
"A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"
Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF" #End Region
Sub Main()
End Sub
End Class

This makes your DLL emulate an ActiveX control. From here, you can

register
it, or select the option in the project properties to register it for COM interop. One thing to remember about the ID's, you need to use the

utility
"Luis Gustavo" <lg****@nsb.com.br> wrote in message guidgen, and select
Registry Format. Otherwise, should work just fine.

Good Luck and HTH
Tibby

news:e9**************@TK2MSFTNGP09.phx.gbl...
Good afternoon.

I would like to know if is possible use a dll made in Vb.net in VB 6.

I made this to test the dll:

Imports System.Data

Imports System.Xml

Public Class RH

Public Shared Function addHistory(ByVal txtFind As String, ByVal

txtReplace
As String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

the code is rigth, when I try to register with the command "regsvr32"

happen
a error:
"---------------------------
RegSvr32
---------------------------
ReplaceHistory.dll was loaded, but the DllRegisterServer entry point was
not
found.

DllRegisterServer may not be exported, or a corrupt version of
ReplaceHistory.dll may be in memory. Consider using PView to detect

and remove it.
"
What I need to make to use the dll in VB 6?

Luis Gustavo - Brazil

msn: lu*********@cions.com.br



Nov 20 '05 #6
"Luis Gustavo" <lg****@nsb.com.br> schrieb
[code]

===================================

I build the solution and is OK !!!

then I open the prompt and execute the command "regasm.exe" so
"regasm replacehistory.dll" and display the message:
"Microsoft (R) .NET Framework Assembly Registration Utility
1.1.4322.573 Copyright (C) Microsoft Corporation 1998-2002. All
rights reserved.

Types registered successfully"

I try too: "regasm ReplaceHistory.dll /regfile:rh.reg" and display
the message:
"
Microsoft (R) .NET Framework Assembly Registration Utility
1.1.4322.57 Copyright (C) Microsoft Corporation 1998-2002. All
rights reserved.

Registry script 'C:\Documents and Settings\gustavo\My
Documents\VBdotN ace\ReplaceHistory\ReplaceHistory\bin\rh.reg'
generated successfully "
and open the reg file.

You don't have to execute regasm. If "[x] register for COM interop" is
checked in the project properties, it is automatically registered.
when I try to execute "regsvr32", the same message is display.


You don't need regsvr32.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #7
Luis,

You should not use regsvr32! Forget about it completely in .NET world!
I have a sample retg file in the office that I will send you tomorrow. But:

1. Why do you have two assembly GUIDs? See:
'<Assembly: Guid("E8C42458-4ED8-4485-8145-A364D099BC5B")>

<Assembly: Guid("6489269F-2E92-448B-96AF-A9C70B7C8E71")>

Only the last one will be used.

2. You have to use codebase switch that points to your assembly while using
REGASM.EXE. Just run regasm.exe /? to get help or use MSDN to see how that
switch works. You also can add the "codebase" registy entry yourself but it
is more prone to errors.

I know these because I spent half of a day finding my way through poor
explanations of MSDN (Sorry Bill Gates!).

Good luck
Ali

"Luis Gustavo" <lg****@nsb.com.br> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl... First, thank for your helps !!!
What I'm doing wrong ?

the code:

class1.vb:
===================================
Imports System.Data

Imports System.Xml

<ComClass(RH.ClassID, RH.InterfaceId, RH.EventsId)> _

Public Class RH

#Region "COM Class IDs"

Public Const ClassID As String = "5F0D4112-B23D-4703-94F5-B5B96E50F3BB"

Public Const InterfaceId As String = "A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"
Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF"

#End Region

Public val As Integer

Public Sub New()

val = 0

End Sub

Public Function addHistory(ByVal txtFind As String, ByVal txtReplace As
String) As String

Return "Luis Gustavo Aleixo"

End Function

End Class

===================================
AssemblyInfo.vb:
===================================
Imports System

Imports System.Reflection

Imports System.Runtime.InteropServices

<Assembly: AssemblyTitle("")>

<Assembly: AssemblyDescription("")>

<Assembly: AssemblyCompany("")>

<Assembly: AssemblyProduct("")>

<Assembly: AssemblyCopyright("")>

<Assembly: AssemblyTrademark("")>

<Assembly: CLSCompliant(True)>

'<Assembly: Guid("E8C42458-4ED8-4485-8145-A364D099BC5B")>

<Assembly: Guid("6489269F-2E92-448B-96AF-A9C70B7C8E71")>

<Assembly: AssemblyVersion("1.0.*")>

===================================

I build the solution and is OK !!!

then I open the prompt and execute the command "regasm.exe" so "regasm
replacehistory.dll" and display the message:
"Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Types registered successfully"

I try too: "regasm ReplaceHistory.dll /regfile:rh.reg" and display the
message:
"
Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.57
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Registry script 'C:\Documents and Settings\gustavo\My Documents\VBdotN
ace\ReplaceHistory\ReplaceHistory\bin\rh.reg' generated successfully
"
and open the reg file.

when I try to execute "regsvr32", the same message is display.

"Tibby" <ti*************@hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP11.phx.gbl...
I need to make one minor correction, in this portion:
<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> ;
Rythmia is the name of my class, so it should read Class1 in this example.

"Tibby" <ti*************@hotmail.com> wrote in message
news:#3**************@TK2MSFTNGP09.phx.gbl...
Add this Code
<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> _
Public Class Class1
#Region "COM Class IDs"
Public Const ClassID As String =

"5F0D4112-B23D-4703-94F5-B5B96E50F3BB" Public Const InterfaceId As String =
"A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"
Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF" #End Region
Sub Main()
End Sub
End Class

This makes your DLL emulate an ActiveX control. From here, you can

register
it, or select the option in the project properties to register it for COM interop. One thing to remember about the ID's, you need to use the

utility
"Luis Gustavo" <lg****@nsb.com.br> wrote in message guidgen, and select Registry Format. Otherwise, should work just fine.

Good Luck and HTH
Tibby

news:e9**************@TK2MSFTNGP09.phx.gbl...
> Good afternoon.
>
> I would like to know if is possible use a dll made in Vb.net in VB 6. >
> I made this to test the dll:
>
> Imports System.Data
>
> Imports System.Xml
>
> Public Class RH
>
> Public Shared Function addHistory(ByVal txtFind As String, ByVal
txtReplace
> As String) As String
>
> Return "Luis Gustavo Aleixo"
>
> End Function
>
> End Class
>
> the code is rigth, when I try to register with the command "regsvr32" happen
> a error:
> "---------------------------
> RegSvr32
> ---------------------------
> ReplaceHistory.dll was loaded, but the DllRegisterServer entry point was not
> found.
>
> DllRegisterServer may not be exported, or a corrupt version of
> ReplaceHistory.dll may be in memory. Consider using PView to detect and > remove it.
> "
> What I need to make to use the dll in VB 6?
>
> Luis Gustavo - Brazil
>
> msn: lu*********@cions.com.br
>
>
>
>



Nov 20 '05 #8
On development machine yes but not on production machine... You need to
register the component on the client. I usually create reg file and then
manually edit it (chop off unrelated bits) and then run it on client.
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uh*************@tk2msftngp13.phx.gbl...
"Luis Gustavo" <lg****@nsb.com.br> schrieb
[code]

===================================

I build the solution and is OK !!!

then I open the prompt and execute the command "regasm.exe" so
"regasm replacehistory.dll" and display the message:
"Microsoft (R) .NET Framework Assembly Registration Utility
1.1.4322.573 Copyright (C) Microsoft Corporation 1998-2002. All
rights reserved.

Types registered successfully"

I try too: "regasm ReplaceHistory.dll /regfile:rh.reg" and display
the message:
"
Microsoft (R) .NET Framework Assembly Registration Utility
1.1.4322.57 Copyright (C) Microsoft Corporation 1998-2002. All
rights reserved.

Registry script 'C:\Documents and Settings\gustavo\My
Documents\VBdotN ace\ReplaceHistory\ReplaceHistory\bin\rh.reg'
generated successfully "
and open the reg file.

You don't have to execute regasm. If "[x] register for COM interop" is
checked in the project properties, it is automatically registered.
when I try to execute "regsvr32", the same message is display.


You don't need regsvr32.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #9

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

Similar topics

20
by: syd | last post by:
In my project, I've got dozens of similar classes with hundreds of description variables in each. In my illustrative example below, I have a Library class that contains a list of Nation classes. ...
6
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at...
4
by: Brian Shannon | last post by:
I am playing around with class libraries trying to understand how they work. I created a class library, library.vb. I placed the library.dll into the bin directory and set my reference. If I...
3
by: eBob.com | last post by:
I have several applications which mine web sites for personal information which they publish. They publish the info in one form, I transform the info into Excel spreadsheets. So all these...
5
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. Here we have a class called B One project...
0
by: tony | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. In this user control we have a class...
5
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
5
by: Rainer Queck | last post by:
Hello NG, Is it possible to share the settings of an application with a class libreary? In my case I have a application and a set of different reports (home made) put into a class library. The...
0
by: drawing in aspnet | last post by:
Question about putting the data layer in a separate class library. I keep reading that the data layer should be separated from the presentation layer and put in its own class library. I am...
4
by: Steve Baer | last post by:
I've already tested this with C# and it works, but I'm being paranoid and I wanted to also check here. Our application has a large class library written in C++/CLI for plug-in projects. The...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.