A follow-up question to one earlier: I’ve created an object in the Form1 : Form class with:
public struct POStruct
{
public List<string> staticCustInfo;
public List<List<string>> itemCollection;
public int testInt;
}
POStruct myObject = new POStruct();
However, when I try to access myObject from public void ItemSubmit_Click_1(object sender, EventArgs e) I get errors saying it’s not instantiated. I thought I already instantiated it above with the line POStruct myObject = new POStruct();?
Thanks for the help.
You’re instantiating POStruct, but that struct has two
List<>objects that aren’t instantiated. When you instantiate myObject, you need to set these two properties to something of use, e.g.:If that doesn’t help, can you post the whole class, with event handler, the exact message, and the line of code that’s triggering the exception?