i am trying to populate listview on selection of node from treeview but every time i select node its get append in the listview my Listview.Items.Clear() function not working. My Code:
listView1.Clear();
if (this.treeView1.SelectedNode.Tag != null)
{
string msg = this.treeView1.SelectedNode.Tag.ToString();
int complaint_id = Convert.ToInt32(msg);
PopulateDataTable2(complaint_id);
foreach (DataRow row11 in dsTreeView_Info.Tables["Complaints_Info"].Rows)
{
listView1.Items.Add(new ListViewItem() { Text = row11["Complaint_Descriptions_Info"].ToString() });
}
}
i am not clearing the data-set after forecah. so it item keep adding.
dsTreeView_Info.Clear();
Thanks " DJ KRAZE".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.