Reputation: 35
I've a Form called Patient Complaints
. I have created some complaints CheckBoxes and added a Button. Also I have added columns to the DataGridView by the name of all complaints.
What I need to do when the user checks the complaints using the CheckBoxes and then clicks a Button, the values should be inserted in specific Columns of the DataGridView.
For example, if the user checked three complaints like Smoking
, Chest Pain
, Fatigue
, then these three values should be added as one row in their particular column like Smoking
will be added to the SmokingColumn
, Chest Pain
will be added to the "ChestPainColumn" column and so on, as a single row.
Is there any way to do that?
I've tried this way before to add a new row to the DataGridView:
this.dgViewPComplaints.Rows.Add("Value1", "Value2", "Value3");
but on that time I was inserting values in all columns and for now I just have to insert values in specific columns.
Upvotes: 0
Views: 113
Reputation: 453
What about adding each CheckBox column. For example:
DataGGridViewCheckBoxColumn dgvCmb = new DataGGridViewCheckBoxColumn();
dgvCmb.ValueType = typeof(bool);
dgvCmb.Name = "Chk1";
dgvCmb.HeaderText = "Smoking";
dgViewPComplaints.Columns.Add(dgvCmb);
Upvotes: 0