private void btnAddAttribute_Click(object sender, EventArgs e) { AttributeControl operAttributeControl = new AttributeControl(); switch (comboViewAttr.SelectedIndex) { case 1: operAttributeControl.openAttributeForm(_softwareID, _software, _dashBoard, comboViewAttr.SelectedIndex); break; case 2: if (dgvViewAttr.SelectedRows.Count < 0) //Assume we are adding a configItem { operAttributeControl.openAttributeForm(_softwareID, _software, _dashBoard, comboViewAttr.SelectedIndex); } else { operAttributeControl.openAttributeForm(_softwareID, _software, _dashBoard, comboViewAttr.SelectedIndex, Convert.ToInt32(dgvViewAttr.SelectedRows[0].Cells[0].Value.ToString())); } break; default: operAttributeControl.openAttributeForm(_softwareID, _software, _dashBoard); break; } }
private void btnAddAttr_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count != 0) { AttributeControl attControl = new AttributeControl(); switch (cmbDataViews.SelectedIndex) { case 0: attControl.openAttributeForm( Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[8].Value.ToString()), dataGridView1.SelectedRows[0].Cells[0].Value.ToString().Trim(), this); break; case 1: attControl.openAttributeForm( Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[4].Value.ToString()), dataGridView1.SelectedRows[0].Cells[0].Value.ToString().Trim(), this); break; case 2: attControl.openAttributeForm( Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[7].Value.ToString()), dataGridView1.SelectedRows[0].Cells[0].Value.ToString().Trim(), this); break; } } }