Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am able to create a structure inside a structure in vb.net but i am confused as to assign values to the inner structure. I want to send the root structure (which contains the value of its own as well those of the inner structure) to another procedure.    Someone please help.   Thanks in advance

modified on Wednesday, May 27, 2009 6:07 AM
Posted

1 solution

Something like this?
Public Structure InnerStruct<br />    Public InnerTest As String<br />End Structure<br />Public Structure RootStruct<br />    Public Test As String<br />    Public myStruct As InnerStruct<br />End Structure<br /><br />Public Class Form1<br /><br />    Public Sub ShowInnerText(ByVal whatStruct As RootStruct)<br />        MessageBox.Show(whatStruct.myStruct.InnerTest)<br />    End Sub<br /><br />    Private Sub Button1_Click(ByVal sender As System.Object, _<br />      ByVal e As System.EventArgs) Handles Button1.Click<br /><br />        Dim newStruct As RootStruct<br />        newStruct.myStruct.InnerTest = "Hello world"<br />        ShowInnerText(newStruct)<br /><br />    End Sub<br /><br />End Class


 
Share this answer
 
Comments
tiagu 1-Apr-16 13:04pm    
Thank you Mr. Eddy for your reply. Started implementing it long back after looking at your reply. But I did not thank you i think. So all thanks to you now buddy.
  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900