private void BtnKillProces_Click(object sender, EventArgs e) { int[] ID_Process = new int[dgvPr.Rows.Count]; int index = 0; foreach (DataGridViewRow row in dgvPr.Rows) { ID_Process[index] = (int)row.Cells["id"].Value; index++; } if (ID_Process.Length != 0) { ProcessOneS.KillProces(ID_Process); dgvPr.Rows.Clear(); } }
private void BtnGetProcess_Click(object sender, EventArgs e) { List <Process> collectionProces = ProcessOneS.GetProcess1c(); if (dgvPr.Rows.Count > 1) { dgvPr.Rows.Clear(); } if (collectionProces.Count != 0) { foreach (Process str in collectionProces) { var newstr = dgvPr.Rows.Add(); dgvPr.Rows[newstr].Cells["id"].Value = str.Id; dgvPr.Rows[newstr].Cells["start"].Value = str.StartTime; dgvPr.Rows[newstr].Cells["name"].Value = str.ProcessName; } } }