You have not instantiated itemname
. You need to do this (3 is just a random number):
public static string[] itemname = new string[3];
If you didn’t do this, you should have received the error on this line:
itemname[id] = "foo";
0
solved List box Object reference not set to an instance of an object