I am having a problem with a System.NullReferenceException error. I have a single page with about 10 listbox pairs, and a set of << and >> buttons. The user should be able to use the buttons to select items from the list on the left and move them to the list on the right. I have a tree, and depending on the node that the user picks, only one listbox pair is actually visible at a time. I would like to pass the visible listbox in as a parameter to a single Move function. I could not figure this out, so I tried declaring a listbox variable for the To and From listboxs, and setting them equal to the appropriate listboxes during the tree's onClick event. My debugging shows that this works, but I am having a problem when I fire the move_onclick event. Somewhere in between the tree onclick event's end and the move_onclick, the variables are being set back to nothing. Naturally, when I try to reference them in the move sub, I get the System.NullReferenceException Error. Ex:
Does anyone have any idea where I am going wrong? I know that the variables are being set properly at some point. I only access the variable in the tree_onclick and the Move_Onclick. Thanks in advance,
Jen
Code:
List_S.Items.Add(New ListItem(List_L.SelectedItem.Text, List_L.SelectedItem.Value))
Jen