Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sub-Sectioning a DLL file

Posted on 2004-04-17
8
Medium Priority
?
156 Views
Last Modified: 2010-05-02
Hi experts!

I'm writing an ActiveX dll from VB which has got a LOAD of different functions.  What i'd ideally like to do, for the sake of easy scripting is to subdivide to dll.

EG  rather that going:

MyDll.GetRecordset

MyDLL.RandomNumber

to have

MyDLL.DatabaseFunctions.GetRecordset

MyDLL.NumericFunctions.RandomNumber

If not i'll just have to write 2 DLL files or tolerate it as it is.

Thanks for you help and time.

Bobeo
0
Comment
Question by:Bobeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10849087
A single DLL can hold MULTIPLE classes, and each class can provide its own set of methods and properties.

So your DLL would have the classes

Public Class DatabaseFunctions
   Public Function GetTRecordSet() as Recordset
     ' add you code here
   End Function

End Class

Public Class NumericFunctions
   Public Function RandomNumber() as Single
     'add your code here
   End Function
   
   Public Function RandomNumber(Seed as Integer) as Integer
     ' add your code for this version of the function
   End Function

   Public Function RandomNumber(LowValue as Integer, HighValue as Integer) as Integer  
     'add code for the function to return a value between LowValue and HighValue  
   End Function
End Class


then you access these functions, in their separate classes within your DLL, exactly as you have described in your question.

AW
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10849092
the above was in .NET, in VB 6, you cannot have two functions with the same name, so your code would look like this:


Public Class DatabaseFunctions
   Public Function GetTRecordSet() as Recordset
     ' add you code here
   End Function

End Class

Public Class NumericFunctions
   Public Function RandomNumber() as Single
     'add your code here
   End Function
   
End Class
0
 
LVL 3

Author Comment

by:Bobeo
ID: 10849104
Hi Arthur_Wood!  And thanks for your reply!

but when i put

Public Class DatabaseFunctions

into my Class module it give me the error

Compile Error
Expected: End of statement

Am I doing something wrong?!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:Bobeo
ID: 10849117
It's picking up the word 'Class' as a variable, not a function.

As in

Public Class as Integer

Etc!
0
 
LVL 3

Author Comment

by:Bobeo
ID: 10849261
Upping the points to 500
0
 
LVL 3

Author Comment

by:Bobeo
ID: 10849622
OK, problem solved.

I used the VB Class Builder Add-In to drag all of my classes into one class, the compiled the DLL from that.

Will get Community Support to close the question
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 10881776
PAQd, 500 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question