| | |
USING CLASSES in VB6
![]() |
I'll do both. Without going into crazy whacky details, a class is basically the base for creating your own objects. In order to do this, you add a "Class Module" to Your VB6 project, and you can build your own object. This object can be anything and do anything... it can have it's own properties, it's own methods, a constructor, and a destructor. In VB you can then instantiate an instance of this class as an object, and use it just like any other object.
and a link:
http://64.233.167.104/search?q=cache...hl=en&start=19
and a link:
http://64.233.167.104/search?q=cache...hl=en&start=19
•
•
Join Date: Mar 2005
Posts: 4
Reputation:
Solved Threads: 0
Hi,
What is a class?
A class can be defined a structure that is composed of two things:
- Data Members.
- Methods.
A class is designed to be reused, when using a class we dont have to know, how it is designed, we just need to know the interface and methods signatures.
Why using a class in vb?
We use class to create composant that can be reused in other application.
Such example, creating a class that do the following:
- Create an ODBC connection to a Database,
- Create an OLEDB connection,
- Get a recordset from the DB,
- Execute Function (Insert, Update, ...statements)
- Check if a connection status to a DB,...
As you can se this functions are already used to deal with a DB.
How to use a class?
You have to create an instance of that class (called object)
We have a compoent called dataLayer in which there is a class called clsDataLayer, some of it's methods are ODBCConnect,GetDisRecordsetPage...
Dim oData as new datalayer.clsdtalayer
Dim MyCnn as new adodb.Connection
set MyCnn =oData.ODBCConnect("DsnEssai")
Regards
What is a class?
A class can be defined a structure that is composed of two things:
- Data Members.
- Methods.
A class is designed to be reused, when using a class we dont have to know, how it is designed, we just need to know the interface and methods signatures.
Why using a class in vb?
We use class to create composant that can be reused in other application.
Such example, creating a class that do the following:
- Create an ODBC connection to a Database,
- Create an OLEDB connection,
- Get a recordset from the DB,
- Execute Function (Insert, Update, ...statements)
- Check if a connection status to a DB,...
As you can se this functions are already used to deal with a DB.
How to use a class?
You have to create an instance of that class (called object)
We have a compoent called dataLayer in which there is a class called clsDataLayer, some of it's methods are ODBCConnect,GetDisRecordsetPage...
Dim oData as new datalayer.clsdtalayer
Dim MyCnn as new adodb.Connection
set MyCnn =oData.ODBCConnect("DsnEssai")
Regards
Also, the main thing about a class is that it is not a module (.bas) file. Like it was already stated, you can create an instance of a class and access all of its public methods and members.
Did that clear everything up, or do you still have questions?
Did that clear everything up, or do you still have questions?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
if (codeWritten = true) and (codePosted = true) then objComatose.happy = true else objComatose.rant = true end if
![]() |
Similar Threads
- Help on Creating Class in VB6 (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Can some one help me with this code plz
- Next Thread: how to pass a form to another form
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows







Thanx, I have my moments...