private void ButtonHeaderClick(object sender, EventArgs e) { var form = new HttpHeaderForm(); var result = form.ShowDialog(); if (result == DialogResult.OK) { var index = gridHeaders.Rows.Add(); var row = gridHeaders.Rows[index]; row.Cells[1].Value = form.HeaderName; row.Cells[2].Value = form.HeaderValue; } }
private void GridCellDoubleClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; if (grid.SelectedRows.Count > 0) { var row = grid.SelectedRows[0]; var form = new HttpHeaderForm((String)row.Cells[1].Value, (String)row.Cells[2].Value); var result = form.ShowDialog(); if (result == DialogResult.OK) { row.Cells[1].Value = form.HeaderName; row.Cells[2].Value = form.HeaderValue; } } else { MessageBox.Show("You should select an item in the http headers list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }