Solved

Proper way to build a VB COM object

Posted on 2002-05-25
6
133 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
ID: 7034683
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
ID: 7035411
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
ID: 7035415
keep in mind to implement the COM Concept as follows:
Client--->BuisnissObject--->DataObject--->DataAccess--->Backend.
Regards.
Meer.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:ccleebelt
ID: 7035576
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
ID: 7035589
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
ID: 7320420
sorry it took so long to close.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

790 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