private void btnNodeSelected_Click(object sender, EventArgs e) { if (dgNodes.SelectedRows.Count > 0) { int rowIndex = dgNodes.SelectedRows[0].Index; MyNode node = _nodes[rowIndex]; MyNode nodeSelected = node.Clone(); _nodesSelected.Add(node); dgNodes.Refresh(); showSelectedNodes(); if (dgNodesSelected.Rows.Count > 0) { dgNodesSelected.Rows[dgNodesSelected.Rows.Count - 1].Selected = true; } } }