Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
440
Add an item to a listview
posted

            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.

Parents
No Data
Reply
  • 440
    Verified Answer
    posted

     

    lstQuery.Items.Add(_bq.Id.ToString(),

     

    String.Format("{0} - {1} - {2}"

    ,

     

     

    "Equipment"

    , cmbType.Text.ToString(), ultraEnum.Current.Value.ToString()));

    I was not casting the key to a string.

Children
No Data