Hello everybody, I need a little help.
I have a structure
Public Structure GatesPositions
Public pos As Integer
Public stack As Stack
End Structure
and an array of the defined type
Public UsrCheckerGates() As GatesPositions
That means that every element of UsrCheckerGates is composed from a stack and an integer.
And the what I want to do is to check if the stack is empty but I don't know the way to do it.
The elements count of UsrCheckerGates is changeable, because I have to add elements, without loosing the already stored.
So...
ReDim Preserve UsrCheckerGates(UsrCheckerGates.Length + 1) 'it increases the size of UsrCheckerGates at 1
Dim tmpStack As New Stack
tmpStack.Push(UsrCheckers(i))
Dim iSt As Byte
For iSt = 0 To UsrCheckerGates.Length - 2
[highlight #EF2929] If UsrCheckerGates(iSt).stack.Count = 0 Then[/highlight] here is the error and i need your help
UsrCheckerGates(iSt).stack = tmpStack
UsrCheckerGates(iSt).pos = Rd1 + 1
Exit For
End If
Next
The error is NullReferenceException was unhadled and I want to find a way just to check the null value of stack, which means the emptyness.
Any suggestions please??? Any help will be much appreciated.
Thank you so much
in advanced.
I have a structure
Public Structure GatesPositions
Public pos As Integer
Public stack As Stack
End Structure
and an array of the defined type
Public UsrCheckerGates() As GatesPositions
That means that every element of UsrCheckerGates is composed from a stack and an integer.
And the what I want to do is to check if the stack is empty but I don't know the way to do it.
The elements count of UsrCheckerGates is changeable, because I have to add elements, without loosing the already stored.
So...
ReDim Preserve UsrCheckerGates(UsrCheckerGates.Length + 1) 'it increases the size of UsrCheckerGates at 1
Dim tmpStack As New Stack
tmpStack.Push(UsrCheckers(i))
Dim iSt As Byte
For iSt = 0 To UsrCheckerGates.Length - 2
[highlight #EF2929] If UsrCheckerGates(iSt).stack.Count = 0 Then[/highlight] here is the error and i need your help
UsrCheckerGates(iSt).stack = tmpStack
UsrCheckerGates(iSt).pos = Rd1 + 1
Exit For
End If
Next
The error is NullReferenceException was unhadled and I want to find a way just to check the null value of stack, which means the emptyness.
Any suggestions please??? Any help will be much appreciated.
Thank you so much
in advanced.