//在绑定数据源的情况下添加一行
DataRow dr = ((DataTable)dataGridViewX1.DataSource).NewRow();
dr["scode"] = "555";
((DataTable)dataGridViewX1.DataSource).Rows.Add(dr);
选中指定行
foreach (DataGridViewRow row in dataGridViewX1.Rows)
{
row.Selected = false;
//MessageBox.Show(row.Cells["scode"].ToString());
//MessageBox.Show(row.Cells[1].Value.ToString());
if (Convert.ToInt32(row.Cells[1].Value.ToString()) == s_code)
{
row.Selected = true;
}
}
设置AdvTree节点不能拖动
this.advTree1.DragDropEnabled = false;