Solved

Proper way to build a VB COM object

Posted on 2002-05-25
6
130 Views
Last Modified: 2010-05-02
EE-

I typically use ASP to script all my sites, but need to move some code to VB COM but I am uncertain as to the best way to start my VB project.

Here are the items I will need to use.

Call stored procedure (ADODB.COMMAND)
Return recordsets (ADODB.RECORDSET)
Data Connections (ADODB.CONNECTION)

I will also need to reference objects such as Jmail to send emails from the object.

My question is

a) What is the best way to start to build the object
b) How do I make the object perform optimally (multithreading?)
3) If I reference 3rd party objects in my object, do they need to be installed on the box that runs my object after I compile with the reference?
4) How do I return recordsets from COM?

Any other helpful hints would be appreciated.  I am basically rewriting ASP code in COM for performance issues.

Thanks!
0
Comment
Question by:ccleebelt
  • 2
  • 2
  • 2
6 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 100 total points
Comment Utility
a) Start a new project and select AtiveX DLL
b) Don't even bother with VB6.
3) Yes.  JMail and any other third party objects will have to be registered on the same box in order to use them.
4) Rather than returning the recordset, expose properties that give you the values you wish to use in ASP.  Also, create a "MoveNext" method in your DLL that mimics the Recordset's MoveNext method.  This way you do not need to instantiate ADO in your ASP and you can use it for the sole purpose of displaying the results of your DLL.

Anthony
0
 

Expert Comment

by:mirghani
Comment Utility
hi,
from my point of view u start with ur Standard EXE VB Project and start adding ur Classes and when u want to use a method in certain class do the following:
Dim MyCls as MyProj.ComCls
Set MyCls=New MyProj.ComCls
then u can call: MyCls.DoAnyThing
after building a proper classes without bugs u could choose ur new ActiveX Dll and Past the Code over there.
when u want to compile Remeber to check the Remote Server Files CheckBox as to Produce TLB and VBR files on compiling then ur Files could be Exported to the Clients.
Regards.
Meer.
0
 

Expert Comment

by:mirghani
Comment Utility
keep in mind to implement the COM Concept as follows:
Client--->BuisnissObject--->DataObject--->DataAccess--->Backend.
Regards.
Meer.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:ccleebelt
Comment Utility
This does not answer the question at all.

acperkins - can you please expand on your recordset movenext idea?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
Sure.  Once you have identified the properties you want to expose, then create a MoveNext method in your ActiveX DLL.
This will execute the MoveNext method in your recordset and populate the properties (actually there internal variables).  As I mentioned before this will avoid you having to instantiate a recordset in your ASP.

I realize I have painted a broad picture, but that is because I am not familiar with the details of your project, so I have deliberately been general.

Anthony
0
 

Author Comment

by:ccleebelt
Comment Utility
sorry it took so long to close.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now