07-24-2018
07:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-24-2018
07:17 AM
Hi, tmistretta
You are getting the dimension values from your itm, and then in the foreach you are looping through lstStraight.
Then in your foreach loop, you are trying to show the message box for the values you previously created, which would only show the values from the object "itm", and not the "value" object.
The reason for your error is that baseDim and/or baseDim2 is null. That means there is not a dimension whose name is "Length" and/or "Width" in that item's list of dimensions.
If you wanted to display a list of all dimension values for all your items, you could do something like this:
foreach (var itm in myItems)
{
var builder = new StringBuilder();
foreach (var dimension in itm.Dimensions)
{
builder.AppendLine($"{dimension.Name}: {dimension.Value.ToString()}");
}
MessageBox.Show(builder.ToString());
}