Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

how can I force a checkmark in the cechbox when using DataGridViewBoxColumn

$
0
0

For some of the rows, I want the check box to default with the Check in the checkbox.

                        //Name = elements[1] + "," + elements[2];
                        //textBox1.Text = Name;
                        dataGridView1.AutoGenerateColumns = false;
                        dataGridView1.ColumnCount = 7;
                        dataGridView1.Columns[0].Name = "Lab Order Number";
                        dataGridView1.Columns[1].Name = "Test Date ";
                        dataGridView1.Columns[2].Name = "Doctor ";
                        dataGridView1.Columns[3].Name = "Facility ";
                        dataGridView1.Columns[4].Name = "Status ";
                        dataGridView1.Columns[5].Name = "Tests";

                         DataGridViewCheckBoxColumn myCheckedColumn = new DataGridViewCheckBoxColumn()
                            {
                                Name = "Reviewed Report",
                                FalseValue = 0,
                                TrueValue = 1,
                                Visible = true
                            };
                            // add the new column to your dataGridView
                            dataGridView1.Columns.Add(myCheckedColumn);

If this was regular check box, I would be able to simply state myCheckColumn.Checked = true.

However there is no Check property for a check box generated with the DataGridViewCheckBoxColumn class.

Can someone please tell me how to do this?

Thank you.

   


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>