Here comes the trouble.
I want to delete all rows from datagridview.
This how i add rows:
private void ReadCompleteCallback(object clientHandle, Opc.Da.ItemValueResult[] results)
{
foreach (Opc.Da.ItemValueResult readResult in results)
{
dataGridView1.Invoke(new MethodInvoker(() => dataGridView1.Rows.Add(readResult.ItemName, readResult.Quality, readResult.Timestamp,readResult.Value)));
}
}
And its how i clear gridview:
private void treeView1_SelectionsChanged(object sender, EventArgs e)
{
dataGridView1.Rows.Clear();
items = new Opc.Da.Item[treeView1.SelectedNodes.Count];
foreach (TreeNode x in treeView1.SelectedNodes) {
items[treeView1.SelectedNodes.IndexOf(x)] = new Opc.Da.Item();
items[treeView1.SelectedNodes.IndexOf(x)].ItemName = x.Text;
}
group.AddItems(items);
group.Read(group.Items, 123, new Opc.Da.ReadCompleteEventHandler(ReadCompleteCallback), out req);
}
in debug i see that dataGridVIew1.Rows.Count=0, but on form, grid doesnt become clear. what a point?
on each selection in tree, i want to see new rows in table.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…