Hi,
i have the following class
and the next class makes a collection of roomsCode:Public Class room Public roomID As Integer Public hotelID As Integer Public size As String Public singleDouble As String Public enSuite As Boolean Public cost As Integer Public description As String End Class
the problem i have is that i am trying to check to see if a room has been added to the collection already. This would be checked by the roomID(which is added as a key when the add procedure is used). Is there an easy way or do i have to loop through the collection and check each room to see if it exists?Code:Public Class rooms Private mcolRooms As New Collection() 'add a room to our collection Public Sub add(ByVal room As room, ByVal key As String) mcolRooms.Add(room, key) End Sub 'return the number of rooms in our collection Public ReadOnly Property Count() As Integer Get Return mcolRooms.Count End Get End Property 'return a room object from our collection Public ReadOnly Property Item(ByVal IndexOrKey As Object) As room Get Return mcolRooms.Item(IndexOrKey) End Get End Property End Class
Thanks
Nick




Reply With Quote