Z
Zahid
Hi,
I have declared a dynamic array in a module so that it
can be used in any of my project classes. The Dynamic
array is declared as:
Module ContainsGlobalVariables
Public Structure MnuDataFrmFile
Public menuGroup As String
Public ItemDesc As String
Public ItemPrice As Single
Public PValue As Integer
End Structure
Public HoldsAllItems() As MnuDataFrmFile
The problem im having is that when i read a line from a
comma seperated data file and split it to populate the
structure in the dynamic array i get the error:
"NullReferenceException"
The error occurs at line:
"HoldsAllItems(LineNoInFile).menuGroup = HoldsItem(0)"
Why?
Here my code for when i try to add the item to the
dynamic array:
Do
v_Item = StreamToDisplay.ReadLine()
HoldsOneItem = Split(v_Item, ",")
HoldsAllItems(LineNoInFile).menuGroup = HoldsItem(0)
HoldsAllItems(LineNoInFile).ItemDesc = HoldsOneItem(1)
v_ItemPrice.Parse(HoldsOneItem(2))
HoldsAllItems(LineNoInFile).ItemPrice = v_ItemPrice
v_PluValue.Parse(HoldsOneItem(3))
HoldsAllItems(LineNoInFile).PluValue = v_PluValue
LineNoInFile += 1
Loop Until v_Item Is Nothing
Please help.
Thanks in advance.
I have declared a dynamic array in a module so that it
can be used in any of my project classes. The Dynamic
array is declared as:
Module ContainsGlobalVariables
Public Structure MnuDataFrmFile
Public menuGroup As String
Public ItemDesc As String
Public ItemPrice As Single
Public PValue As Integer
End Structure
Public HoldsAllItems() As MnuDataFrmFile
The problem im having is that when i read a line from a
comma seperated data file and split it to populate the
structure in the dynamic array i get the error:
"NullReferenceException"
The error occurs at line:
"HoldsAllItems(LineNoInFile).menuGroup = HoldsItem(0)"
Why?
Here my code for when i try to add the item to the
dynamic array:
Do
v_Item = StreamToDisplay.ReadLine()
HoldsOneItem = Split(v_Item, ",")
HoldsAllItems(LineNoInFile).menuGroup = HoldsItem(0)
HoldsAllItems(LineNoInFile).ItemDesc = HoldsOneItem(1)
v_ItemPrice.Parse(HoldsOneItem(2))
HoldsAllItems(LineNoInFile).ItemPrice = v_ItemPrice
v_PluValue.Parse(HoldsOneItem(3))
HoldsAllItems(LineNoInFile).PluValue = v_PluValue
LineNoInFile += 1
Loop Until v_Item Is Nothing
Please help.
Thanks in advance.