Solved

Proper way to build a VB COM object

Posted on 2002-05-25
6
131 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now