sub main()
dim menuhistory as stack(of menu)
dim currentmenu as menu
dim apple as new menu("fruit")
currentmenu = apple
menuhistory.push(currentmenu)
public class menu
menutext as string
Public Sub New(ByVal input As String)
menutext = input
End Sub
end class
end sub
I'm trying to create a stack of menus so I can navigate forward and back between different menus, however when I get down the push line to push my menu onto the stack I get the following error: "NullReferenceException was unhandled: Object reference not set to an instance of an object.". I'm unsure what the problem is as I am trying to push an object onto my stack, a menu object. The same error occurs even if I change the object I am trying to push directly to apple as well.
Any help would be greatly appreciated.