×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Collection Objects/Classes?

Collection Objects/Classes?

Collection Objects/Classes?

(OP)
Ok here is what I am trying to do.
I want to store a collection of "Shapes" so to speak
this is somewhat of the visual representation, I'm looking at it as if they were 3 Collections, 2 types under 1.

Shapes
¦--Name
¦--Sic2
¦ ¦--Sic4
¦ ¦ ¦--Siccode
¦ ¦ ¦--Description
¦ ¦ ¦--Expanded
¦ ¦ ¦--Plotted
¦ ¦ ¦--Total
¦ ¦--Description
¦ ¦--Expanded
¦ ¦--Plotted
¦ ¦--Total
¦--Sic4
¦--Siccode
¦--Description
¦--Expanded
¦--Plotted
¦--Total
Shape2
¦--...
a Shap has its own info, then has a list of Sic2 or Sic4
Sic2 is a broad catagory, like 2 digit 2500
Sic4 is more specific like 4 digits 2538
which has no more collections under it
a Sic4 will have its own info, and stops there
a Sic2 will have its broad description, then all the sic4 that apply to it.

Now the only thing I want to know, is how to create Collections, then manage them like Add, Delete, that kind of thing.
I checked MSDN on a generic collectino type that is only a single collection with nothing under it, using a class as a root for that collection.

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Collection Objects/Classes?

(OP)
I have made 4 Class Module files in order to set up how the Collections might be, I still however trying to figure out how I might be able to do multiple collections under one another

SicCodes (SicCodes.cls)
-----------------------------
Public Shapes As New Collection

Shapes (Shapes.cls)
-----------------------------
Public Name As String
Public Sic2 As New Collection
Public Sic4 As New Collection

Sic2 (Sic2.cls)
-----------------------------
Public SicCode As String
Public SicDesc As String
Public Expanded As Boolean
Public Plotted As Boolean
Public total As Long
Public Sic4 As New Collection

Sic4 (Sic4.cls)
-----------------------------
Public SicCode As String
Public SicDesc As String
Public Plotted As Boolean
Public total As Long


As you can see Sic4 is the only collection that will not have multiples underneath it, and cannot be expanded

Any sugestions?

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Collection Objects/Classes?

(OP)
Oh one of the other things that I wanted to make note of, this "project" I want to keep into a class or Classes of its own , so that it does not have to be on a form or anything else, that way I can make methods , to add, delete, clear, whichever, and when I am ready to move it into an ActiveX control, can just use those methods/functions to get, and set data.

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

RE: Collection Objects/Classes?

(OP)
With the same thing as above, this code i inserted into the SicCode.cls , which basically builds the Shape

Public Sub SicShape(Name As String, ShapeType As String, SIC As String, Desc As String, employers As String)
Dim NewSh As New Shapes
Dim NewS2 As New Sic2
Dim NewS4 As New Sic4
Dim idx As Integer
Dim sicid As String
Dim objSicStuff As Object
Set objSicStuff = CreateObject("wiDataAccess.Dataconnection")

objSicStuff.ConnectionString = "dsn=siccode;uid=sa;pwd;"
objSicStuff.Connect

If Desc = "" Then
Desc = objSicStuff.GetSicTitle(SIC)
End If

'Dont know if this next line will work
If Shapes.Item(Name) Then
NewSh = Shapes.Item(Name)
Else
NewSh.Name = Name
End If

sicid = Trim(SIC)
If Len(sicid) = 2 Then
NewS2.SicDesc = Desc
NewS2.SicCode = sicid
NewS2.total = 0

Set rs = objSicStuff.GetSic4Titles(sicid)
Do While Not rs.EOF
NewS4.SicCode = rs!SicCode
NewS4.SicDesc = rs!sictitle
NewS2.Sic4.Add NewS4
NewS2.total = NewS2.total + 1
rs.movenext
Loop
NewSh.Sic2.Add NewS2
Else
NewS4.SicCode = sicid
NewS4.SicDesc = Desc
NewSh.Sic4.Add NewS4
End If
Shapes.Add NewSh
End Sub

Seems lenghty might be able to shorten it, the main thing now is to make it check to see if a Shape item of the same name already exist and if so just add on a new Sic2 or Sic4.
Then to be able to figure out howto Get , Edit, Delete parts of it.

Karl
kb244@kb244.8m.com

Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close