Problem accessing sub structure element

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    Problem accessing sub structure element

    Hi

    I have an array of structure as below;

    Structure Section
    Structure MasterTable
    Dim Name As String
    End Structure
    End Structure

    Dim Sections(10) As Section

    When I try to use Sections(0).Mas terTable.Name = "MayTable" I get the
    'Reference to a non-shared member requires an object reference.' error.

    What is the problem and how can I fix it?

    Thanks

    Regards


  • Hal Rosser

    #2
    Re: Problem accessing sub structure element


    "John" <John@nospam.in fovis.co.ukwrot e in message
    news:ub0RSy1RIH A.3940@TK2MSFTN GP05.phx.gbl...
    Hi
    >
    I have an array of structure as below;
    >
    Structure Section
    Structure MasterTable
    Dim Name As String
    End Structure
    End Structure
    >
    Dim Sections(10) As Section
    >
    When I try to use Sections(0).Mas terTable.Name = "MayTable" I get the
    'Reference to a non-shared member requires an object reference.' error.
    >
    What is the problem and how can I fix it?
    >
    Thanks
    >
    Regards
    Try declaring the structures separately:
    Structure MasterTable
    Public Name as String
    End Structure

    Structure Section
    Public Bubba as MasterTable
    End Structure

    Dim Sections(10) as Section

    then in a sub...

    Sections(0).Bub ba.Name = "Darrell"


    Comment

    Working...