How do I specify the entry point for a dll written in vb.net?

How do I specify the entry point for a dll written in vb.net?  

I have a project named CardLib with one file named Main.vb (and of course AssemblyInfo.vb).  I want the entry point to be the function DecryptCard in main.vb.

I'm asking because when I try to register the dll with regsvr32 I get the message:

"cardlib.dll was loaded, but the DLllRegisterServer entry point was not found. This file can not be registered."

Also, when I try to call the dll, I get a message saying "Cannot find entry point DecryptCard in the DLL."

So I assume I'm asking the right question.

Can you tell me how to do that?

Thanks.

reh2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
.Net DLLs cannot be registered!
reh2Author Commented:
I still need an entry point to call it from foxpro, so can you tell me how to specify the entry point for a dll written in vb.net?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

athapaCEO / CTOCommented:
Are you trying to create a com component? Foxpro lets you use com components. That may be easier than creating a dll with an entry point.

AT
reh2Author Commented:
Athapa,
Does Foxpro 6.0 let you get values returned from com components? That's what I need to do. If so, can you give me an example how to call one and get a value returned?
Thanks.
reh
reh2Author Commented:
Athapa,
Looking at the .net help it looks to me like automation-enabled com objects can only be written in c++, or am I wrong on that?
I need to do the .net end in vb.net
reh
Daniel Van Der WerkenIndependent ConsultantCommented:
Yes.  You can do this.  However, it's not simple for DLL's that are used outside of Internet Explorer.

You will probably want a couple of books that I'd recommend:

.NET and COM: The Complete Interoperability Guide (Paperback)
http://www.amazon.com/exec/obidos/tg/detail/-/067232170X/qid=1120831521/sr=8-1/ref=pd_bbs_ur_1/104-8044258-6976753?v=glance&s=books&n=507846

and

COM Programming with Microsoft .NET (Paperback)
http://www.amazon.com/exec/obidos/tg/detail/-/0735618755/ref=pd_sim_b_4/104-8044258-6976753?%5Fencoding=UTF8&v=glance

Likewise, search in MSDN at www.msdn.com for "Com Callable Wrapper" and read up on what you find there:

Calling a .NET Component from a COM Component
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp

Hope this helps,

---Dan---
davidlars99Commented:
> let you get values returned from com components?

you can create a "Structure" with some properties and pass it as "ByRef" to a function

Public Structure MyStructure
   Dim var1 As String '// all variables with "Dim" scope are considered as "Public", only in Structures
   Dim var2 As String
End Structure

Dim com As New COMComponent()
Dim struct As New MyStructure()
dom.MyFunction(struct) '// Public Sub MyFunction(ByRef struct As System.Object)


> so can you tell me how to specify the entry point for a dll written in vb.net?

what about putting a "Sub Main" in a class, I'm not 100% sure about it because I've never used it for COM, but you can try...

Public Shared Sub Main()
   '// entry point
End Sub
reh2Author Commented:
Thanks for the info, everyone, but it seems like we're getting a little off-subject. If I can find out how to specify the entry point for a dll written in vb.net I can register it with Foxpro (thru foxpro's mechanism) and use it without using regsrv32.exe.   MSDN's faqs on this error indicates it may be an error on case or spelling of the function name. This isn't the case, since I cut and pasted the function name and have checked it again.

So, does anyone know how to specify the entry point for a dll written in vb.net?

Thanks.
reh
Daniel Van Der WerkenIndependent ConsultantCommented:
You can't regsvr32.exe a .NET control.

You use REGASM.EXE on it.

regasm.exe /codebase <dllname>.DLL

You can create and see the GUID created with:

regasm.exe /regfile

This will create a .REG file that shows what is created in the registry via the /codebase switch.

The entry point will be put into the registry via these means.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
athapaCEO / CTOCommented:
You can get the retturn value as well as any other properties of com component in foxpro.

For example here an excel com component is created and its visible property accessed.

objexcel = createobject ("excel.application")
IF ObjExcel.Visible = .F.  
    ObjExcel.Visible = .T.
EndIf

It is possible to create com component in .net. I had similiar need where .Net class had to be accessed in vb6. I don't think I had to do a whole lot of stuff beside adding few attributes and few changes.

Here are some info on the topic.
http://www.vbdotnetheaven.com/Code/Jun2003/2073.asp

HTH
AThapa
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.