S
sal
Greetings All
I'm learning to use arraylist and structures but I'm getting a
System.NullReferenceException Error and I'm not sure why. I followed the
VB.net book all I did was change the names. See code below
Structure SppElementProperties
Dim Element As String
Dim North As String
Dim South As String
Dim Wave As String
Dim Wake As String
End Structure
Private Sub testform2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim SppElementProperties As ArrayList
Dim Spp As New SppElementProperties
Spp.Element = "Element1"
Spp.North = "North1"
Spp.South = "South1"
Spp.Wave = "Wave1"
Spp.Wake = "Wake1"
SppElementProperties.Add(Spp) 'This is the Line I get an error on
Spp.Element = "Element2"
Spp.North = "North2"
Spp.South = "South2"
Spp.Wave = "Wave2"
Spp.Wake = "Wake2"
SppElementProperties.Add(Spp)
Spp.Element = "Element3"
Spp.North = "North3"
Spp.South = "South3"
Spp.Wave = "Wave3"
Spp.Wake = "Wake3"
SppElementProperties.Add(Spp)
Dim REnum As IEnumerator
REnum = SppElementProperties.GetEnumerator
While REnum.MoveNext
MessageBox.Show(REnum.Current)
End While
End Sub
TIA
I'm learning to use arraylist and structures but I'm getting a
System.NullReferenceException Error and I'm not sure why. I followed the
VB.net book all I did was change the names. See code below
Structure SppElementProperties
Dim Element As String
Dim North As String
Dim South As String
Dim Wave As String
Dim Wake As String
End Structure
Private Sub testform2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim SppElementProperties As ArrayList
Dim Spp As New SppElementProperties
Spp.Element = "Element1"
Spp.North = "North1"
Spp.South = "South1"
Spp.Wave = "Wave1"
Spp.Wake = "Wake1"
SppElementProperties.Add(Spp) 'This is the Line I get an error on
Spp.Element = "Element2"
Spp.North = "North2"
Spp.South = "South2"
Spp.Wave = "Wave2"
Spp.Wake = "Wake2"
SppElementProperties.Add(Spp)
Spp.Element = "Element3"
Spp.North = "North3"
Spp.South = "South3"
Spp.Wave = "Wave3"
Spp.Wake = "Wake3"
SppElementProperties.Add(Spp)
Dim REnum As IEnumerator
REnum = SppElementProperties.GetEnumerator
While REnum.MoveNext
MessageBox.Show(REnum.Current)
End While
End Sub
TIA