Results 1 to 22 of 22

Thread: [Resolved] Class within a class

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Location
    Huddersfield, England
    Posts
    83

    Resolved [Resolved] Class within a class

    I have two classes:

    Code:
            Public Class Sensor
                Public Number As Integer
                Public Name As String
                Public Value As Integer
            End Class
    
            Public Class Transmitter
                Public Number As Integer
                Public Name As String
                Public Type As Integer
                Public MySensor() As Sensor
            End Class
    but I can't work out how to populate the sub class:

    Code:
                Dim MyTX As Transmitter
                Dim MySens As Sensor
                Dim MyTransmitter(9) As Transmitter
    
                MyTX = New Transmitter
                MySens = New Sensor
    
                MyTX.Name = "Transmitter"
                MySens.Name = "Sensor"
                MyTransmitter(0) = MyTX
                MyTransmitter(0).MySensor(0) = MySens
    
                Debug.Print(MyTransmitter(0).MySensor(0).Name)
    as I get an object not set error. Can someone give me the correct syntax?
    Last edited by consciouspnm; Oct 7th, 2010 at 05:14 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width