README.md

December 4, 2022 ยท View on GitHub

Building Classes

Description

Learning the right way to build classes and collection of a class.

More Info

Submitted On
ByVisualProgman
LevelIntermediate
User Rating3.3 (13 globes from 4 users)
CompatibilityVB 6.0
CategoryObject Oriented Programming (OOP)
WorldVisual Basic
Archive File

Source Code

Ok, I just have to thank Microsoft for about 20 hours of research but I ran across these three articles in the MSDN that really shed light on a problem I recently ran into.

I was building a collection of a class in another class and basically wanted to access the information the same way Microsoft does. The simplest example I can think of is the ADODB.Fields relationship compared to the ADODB.Field. ADODB.Fields is really a collection of ADODB.Field.

In Building the classes I ran across a very interesting problem in trying to add information to the collection class.

Finally I discovered a bug in VB which I thought was undocumented until in a very obscure area of the MSDN. Actually found the solution. I'm referring to 3 examples in the MSDN "The House of Straw", The House of Sticks" and "The House of Bricks".

Once going thru these three examples it has shed some real light on the subject and the answer to the problem.

The House of Straw at:

http://MSDN.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconpubliccollectionexamplethehouseofstraw.asp

The House of Sticks at:

http://MSDN.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconprivatecollectionexamplethehouseofsticks.asp

The House of Bricks at:

http://MSDN.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconcreatingyourownclasscollectionthehouseofbricks.asp

My problem was cured when I entered the -4 in The House of Bricks!

Beginners and Intermediates please take the time to do the samples. I guarantee you will be amazed. Man, things just when off in my head wishing I new this a long time ago.

My big question is why hasn't Microsoft fixed this???

I hope this helps everyone the way it helped me!