Click here to Skip to main content
15,912,507 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
i want to add an item in listview with thread i have the following code but it has this error : "Parameter count mismatch."
C#
public void Add_item(ListViewDataItem item, Telerik.WinControls.UI.RadListView listview, string pic_name)
      {
          if (listview.InvokeRequired)
          {
              AddItemCallback d = new AddItemCallback(Add_item);
              listview.Invoke(d, new object[] { item });
          }
          else
          {
              item.Image = imglst.Images[pic_name];
              listview.Items.Add(item);
              item.Text = pic_name;
              item.ImageAlignment = ContentAlignment.TopCenter;
              item.TextImageRelation = TextImageRelation.ImageAboveText;
              item.TextAlignment = ContentAlignment.BottomCenter;

          }
      }

thank you.
Posted
Comments
stibee 14-May-13 3:32am    
Does your imglst.Images contains an element with key "pic_name"
johannesnestler 14-May-13 7:13am    
solved?
MaazSh 28-Sep-13 8:13am    
yes. it is solved.thank u so much ;-)
johannesnestler 1-Oct-13 9:30am    
Hi, nice to hear - late reply is better than no reply!

1 solution

you are giving not all your parameters to the Add_Item method, use
C#
listview.Invoke(d, new object[] { item, listview, pic_name });
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900