List<dc.zlkEquipmentAttributeName> q = _equipment.Getzlk(val);
inflv.UltraListViewItem[] items = new Infragistics.Win.UltraWinListView.UltraListViewItem[q.Count]; Infragistics.Win.UltraWinListView.UltraListViewItem ulv;
for (int i =0; i < q.Count; i++) { //ulv = new Infragistics.Win.UltraWinListView.UltraListViewItem(q[i].description); //ulv = new Infragistics.Win.UltraWinListView.UltraListViewItem(q[i].attributeNameID.ToString());
ulv = new Infragistics.Win.UltraWinListView.UltraListViewItem(); ulv.Key = q[i].attributeNameID.ToString(); ulv.Value = q[i].description; items[i] = ulv;
}
lstEquipment.Items.AddRange(items);
I get Object reference not set to an instance of an object. items is obviously set so I guess I am setting up the individual items incorrectly. Can someone give me an example of what I should be doing.
One possibility is that the 'attributeNameID' member of an element in the 'q' list is null; you are calling ToString on it without checking, so if it is null you would get a null reference exception.
The id is not null. I even looped through each one just to be sure.
System.Console.WriteLine("Key: " + i.Key + " Value: " + i.Value);
Returns
Key: 1 Value: Air Compressor
Can you give me an example of how to do this?