Thank you very much Original Griff. I like the logic a lot. But i am having a hard time understanding on how would i retrieve info on the house if i already have a SubDiv.Street . I have provided the code for viewing.
-----Class ----
Public Class ClassSubD
Private _SubDName As String
Private _StreetCollection As New ArrayList
'--- Constructor
Public Sub New(ByVal SubDName As String)
_SubDName = SubDName
End Sub
'--- Method
Public Sub AddStreet(ByVal Street As ClassStreet)
_StreetCollection.Add(Street)
End Sub
'--- Property
Public ReadOnly Property NumberOfStreets() As Double
Get
Return _StreetCollection.Count
End Get
End Property
End Class
Public Class ClassStreet
Private _StreetName As String
Private _StreetSpeed As Double
Private _HouseCollection As New ArrayList
'--- Constructor
Public Sub New(ByVal StreetName As String, ByVal StreetSpeed As Double)
_StreetSpeed = StreetSpeed
_StreetName = StreetName
End Sub
'--- Method
Public Sub AddHouse(ByVal House As ClassHouse)
_HouseCollection.Add(House)
End Sub
'--- Property
Public ReadOnly Property NumberOfHouses() As Double
Get
Return _HouseCollection.Count
End Get
End Property
End Class
Public Class ClassHouse
Private _HouseNumber As Double
Private _HouseDescription As String
'--- Constructor
Public Sub New(ByVal HouseDescription As String, ByVal HouseNumber As Double)
_HouseNumber = HouseNumber
_HouseDescription = HouseDescription
End Sub
End Class
---Main Class---
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SD As New ClassSubD("Sub Name")
Dim ST As New ClassStreet("Street One", 52647)
Dim House As New ClassHouse("One Level with 2 doors", 51485)
SD.AddStreet(ST)
ST.AddHouse(House)
MsgBox(SD.NumberOfStreets)
End Sub