By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,089 Members | 1,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,089 IT Pros & Developers. It's quick & easy.

Class Library

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.