private void button_Execute_Click(object sender, EventArgs e) { Dictionary <string, string> dicServiceActions = new Dictionary <string, string>(); DataGridViewCheckBoxCell checkBoxCell; foreach (DataGridViewRow row in dataGridView_Services.Rows) { checkBoxCell = row.Cells["selectService"] as DataGridViewCheckBoxCell; if (Convert.ToBoolean(checkBoxCell.Value)) { dicServiceActions.Add(row.Cells["serviceName"].Value.ToString(), row.Cells["serviceAction"].Value.ToString()); } } if (dicServiceActions.Count > 0) { richTextBox_ResultServices.Text = proxy.ServiceActions(dicServiceActions, sessionID); BindGrid(); } else { richTextBox_ResultServices.Text = "There is no service selected"; } }