USING CLASSES in VB6

Reply

Join Date: May 2005
Posts: 29
Reputation: vhinehds is an unknown quantity at this point 
Solved Threads: 0
vhinehds's Avatar
vhinehds vhinehds is offline Offline
Light Poster

USING CLASSES in VB6

 
0
  #1
May 23rd, 2005
hi its me again...

can someone please explain what a class can do? how to call a class?
or if just give me a good link where i can refer to it.

thanks a lot.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: USING CLASSES in VB6

 
0
  #2
May 23rd, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 4
Reputation: bouzahme is an unknown quantity at this point 
Solved Threads: 0
bouzahme bouzahme is offline Offline
Newbie Poster

Re: USING CLASSES in VB6

 
0
  #3
Jun 9th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: USING CLASSES in VB6

 
0
  #4
Jun 9th, 2005
Do me a big favor... when you post, use code tags. You can do that like this
[ CODE]
dim ADO as object
[ /CODE]

with no spaces between the [ and the word or /. Anyway, it helps to make the posts a little bit more readable, and helps make the post more organized. Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 22
Reputation: EricaJanine is an unknown quantity at this point 
Solved Threads: 0
EricaJanine's Avatar
EricaJanine EricaJanine is offline Offline
Newbie Poster

Re: USING CLASSES in VB6

 
0
  #5
Jun 9th, 2005
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?



Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2. if (codeWritten = true) and (codePosted = true) then
  3. objComatose.happy = true
  4. else
  5. objComatose.rant = true
  6. end if
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: USING CLASSES in VB6

 
0
  #6
Jun 9th, 2005
Are You Saying I Rant?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 22
Reputation: EricaJanine is an unknown quantity at this point 
Solved Threads: 0
EricaJanine's Avatar
EricaJanine EricaJanine is offline Offline
Newbie Poster

Re: USING CLASSES in VB6

 
0
  #7
Jun 9th, 2005
Maybe the Shaolin of Rant. :cheesy:
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: USING CLASSES in VB6

 
0
  #8
Jun 9th, 2005
Is That A Good Thing, or a bad one?
Uh Oh, I'm being Monitored.... Quick, put away the big black VB book...
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 22
Reputation: EricaJanine is an unknown quantity at this point 
Solved Threads: 0
EricaJanine's Avatar
EricaJanine EricaJanine is offline Offline
Newbie Poster

Re: USING CLASSES in VB6

 
0
  #9
Jun 9th, 2005
Nah, just ran across another thread on here...thought it was pretty funny, actually.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: USING CLASSES in VB6

 
0
  #10
Jun 9th, 2005
Thanx, I have my moments...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC