Problem accessing sub structure element

  • Thread starter Thread starter John
  • Start date Start date
J

John

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).MasterTable.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
 
John said:
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).MasterTable.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).Bubba.Name = "Darrell"
 
Back
Top